Implements Box2D c++ version 2.4.1

实现Box2D c++ 2.4.1 版本

实现

构造函数

属性

方法

_createBox2DJoint allowWorldSleep appendFlags clearFlags clearForces convertLayaValueToPhysics convertPhysicsValueToLaya createBox2DDraw createContactListener createFilter createJointDef createJSQueryCallback createJSRayCastCallback createMassData createPhyFromLayaVec2 createPhyVec2 createShape createShapeDef createWorld destroyData destroyShape destroyWorld get_DistanceJoint_length get_joint_reactionTorque get_joint_recationForce get_RigibBody_Transform get_rigidBody_allowSleep get_rigidBody_angularDamping get_rigidBody_angularVelocity get_rigidBody_bullet get_rigidBody_Center get_rigidBody_fixedRotation get_rigidBody_gravityScale get_rigidbody_Inertia get_rigidBody_IsAwake get_rigidBody_isEnable get_rigidBody_linearDamping get_rigidBody_linearVelocity get_rigidBody_linearVelocityFromLocalPoint get_rigidBody_linearVelocityFromWorldPoint get_rigidBody_LocalVector get_rigidbody_Mass get_rigidBody_next get_rigidBody_type get_rigidBody_userData get_rigidBody_WorldCenter get_rigidBody_WorldVector get_shape_AABB get_shape_isSensor get_shape_massData getBodyCount getBodyList getContactCount getContactList getContactShapeA getContactShapeB getfilterData getJoint_userData getJoint_userData_destroy getJointCount getJointList getShape getShapeByDef initialize isValidJoint QueryAABB RayCast retSet_rigidBody_MassData rigidbody_ApplyAngularImpulse set_ChainShape_data set_CircleShape_pos set_CircleShape_radius set_collider_SetAsBox set_DistanceJoint_length set_DistanceJoint_MaxLength set_DistanceJoint_MinLength set_DistanceJointStiffnessDamping set_EdgeShape_data set_GearJoint_SetRatio set_Joint_EnableLimit set_Joint_EnableMotor set_Joint_frequencyAndDampingRatio set_Joint_SetLimits set_Joint_SetMaxMotorTorque set_Joint_SetMotorSpeed set_MotorJoint_linearOffset set_MotorJoint_SetAngularOffset set_MotorJoint_SetCorrectionFactor set_MotorJoint_SetMaxForce set_MotorJoint_SetMaxTorque set_MouseJoint_frequencyAndDampingRatio set_MouseJoint_target set_PolygonShape_data set_rigidBody_allowRotation set_rigidBody_allowSleep set_rigidBody_angularDamping set_rigidBody_angularVelocity set_rigidbody_Awake set_rigidBody_bullet set_rigidBody_gravityScale set_rigidBody_linearDamping set_rigidBody_linearVelocity set_rigidBody_Mass set_rigidBody_type set_rigidBody_userData set_rigidbody_Velocity set_shape_density set_shape_friction set_shape_isSensor set_shape_reFilter set_shape_restitution set_shape_restitutionThreshold setContactListener setDestructionListener setfilterData setJoint_userData shape_rayCast shapeCast shiftOrigin start update warpPoint

构造函数

属性

worldCount: number = 0
worldMap: Map<number, Physics2DWorldManager> = ...

方法

  • 参数

    • body: any

      The rigid body.

    返回 number

    The angular velocity.

    Get the angular velocity of a rigid body.

    获取刚体的角速度。

  • 参数

    • body: any

      The rigid body.

    返回 IV2

    The offset of the center of mass.

    Get the offset of the center of mass relative to the node (0, 0) point.

    获取质心相对于节点 (0, 0) 点的位置偏移。

  • 参数

    • body: any

      The rigid body.

    返回 any

    True if the rigid body is awake, false otherwise.

    Check if a rigid body is awake.

    检查刚体是否处于唤醒状态。

  • 参数

    • body: any

      The rigid body.

    返回 IV2

    The world coordinates of the center of mass.

    Get the world coordinates of the center of mass relative to the Physics.I.worldRoot node.

    获取质心相对于 Physics.I.worldRoot 节点的世界坐标。

  • 参数

    • joint: any

      The joint.

    返回 boolean

    True if the user data is marked as destroyed, false otherwise.

    Check if the user data of a joint is marked as destroyed.

    检查关节的用户数据是否被标记为已销毁。

  • 参数

    • shape: any

      The chain shape.

    • x: number

      The x-coordinate of the chain shape's position.

    • y: number

      The y-coordinate of the chain shape's position.

    • arr: number[]

      The vertex array of the chain shape.

    • loop: boolean

      Whether the chain shape is a loop.

    • scaleX: number

      The horizontal scale of the chain shape.

    • scaleY: number

      The vertical scale of the chain shape.

    返回 void

    Set the data of a chain shape.

    设置链条形状的数据。

  • 参数

    • shape: any

      The circle shape.

    • x: number

      The x-coordinate of the circle shape's position.

    • y: number

      The y-coordinate of the circle shape's position.

    • scaleX: number

      The horizontal scale of the circle shape's position.

    • scaleY: number

      The vertical scale of the circle shape's position.

    返回 void

    Set the position of a circle shape.

    设置圆形形状的位置。

  • 参数

    • shape: any

      The circle shape.

    • radius: number

      The radius of the circle shape.

    • scale: number

      The scale of the circle shape.

    返回 void

    Set the radius of a circle shape.

    设置圆形形状的半径。

  • 参数

    • shape: any

      The box collider shape.

    • width: number

      The width of the box.

    • height: number

      The height of the box.

    • pos: IV2

      The position of the box.

    • scaleX: number

      The horizontal scale of the box.

    • scaleY: number

      The vertical scale of the box.

    返回 void

    Set the shape of a box collider as a box.

    将盒子碰撞器的形状设置为盒子。

  • 参数

    • joint: any

      The distance joint.

    • length: number

      The length.

    返回 void

    Set the length of a distance joint.

    设置距离关节的长度。

  • 参数

    • joint: any

      The distance joint.

    • length: number

      The maximum length.

    返回 void

    Set the maximum length of a distance joint.

    设置距离关节的最大长度。

  • 参数

    • joint: any

      The distance joint.

    • length: number

      The minimum length.

    返回 void

    Set the minimum length of a distance joint.

    设置距离关节的最小长度。

  • 参数

    • joint: any

      The distance joint.

    • stiffness: number

      The stiffness.

    • damping: number

      The damping.

    返回 void

    Set the stiffness and damping of a distance joint.

    设置距离关节的刚度和阻尼。

  • 参数

    • shape: any

      The edge shape.

    • x: number

      The x-coordinate of the edge shape's position.

    • y: number

      The y-coordinate of the edge shape's position.

    • arr: number[]

      The vertex array of the edge shape.

    • scaleX: number

      The horizontal scale of the edge shape.

    • scaleY: number

      The vertical scale of the edge shape.

    返回 void

    Set the data of an edge shape.

    设置边缘形状的数据。

  • 参数

    • joint: any

      The gear joint.

    • radio: number

      The ratio to set.

    返回 void

    Set the ratio of a gear joint.

    设置齿轮关节的比率。

  • 参数

    • joint: any

      The joint.

    • enableLimit: boolean

      True to enable the limit, false to disable it.

    返回 void

    Enable or disable the limit of a joint.

    启用或禁用关节的限制。

  • 参数

    • joint: any

      The joint.

    • enableMotor: boolean

      True to enable the motor, false to disable it.

    返回 void

    Enable or disable the motor of a joint.

    启用或禁用关节的马达。

  • 参数

    • joint: any

      The joint.

    • frequency: number

      The frequency.

    • dampingRatio: number

      The damping ratio.

    • isdamping: boolean

      True to apply damping, false otherwise.

    返回 void

    Set the frequency and damping ratio of a joint.

    设置关节的频率和阻尼比。

  • 参数

    • joint: any

      The joint.

    • lowerAngle: number

      The lower angle limit.

    • upperAngle: number

      The upper angle limit.

    返回 void

    Set the limits of a joint.

    设置关节的限制。

  • 参数

    • joint: any

      The joint.

    • maxTorque: number

      The maximum motor torque.

    返回 void

    Set the maximum motor torque of a joint.

    设置关节的最大马达扭矩。

  • 参数

    • joint: any

      The joint.

    • motorSpeed: number

      The motor speed.

    返回 void

    Set the motor speed of a joint.

    设置关节的马达速度。

  • 参数

    • joint: any

      The motor joint.

    • x: number

      The x-coordinate of the linear offset.

    • y: number

      The y-coordinate of the linear offset.

    返回 void

    Set the linear offset of a motor joint.

    设置马达关节的线性偏移量。

  • 参数

    • joint: any

      The motor joint.

    • angular: number

      The angular offset.

    返回 void

    Set the angular offset of a motor joint.

    设置马达关节的角度偏移量。

  • 参数

    • joint: any

      The motor joint.

    • correctionFactor: number

      The correction factor.

    返回 void

    Set the correction factor of a motor joint.

    设置马达关节的校正因子。

  • 参数

    • joint: any

      The motor joint.

    • maxForce: number

      The maximum force.

    返回 void

    Set the maximum force of a motor joint.

    设置马达关节的最大力。

  • 参数

    • joint: any

      The motor joint.

    • maxTorque: number

      The maximum torque.

    返回 void

    Set the maximum torque of a motor joint.

    设置马达关节的最大扭矩。

  • 参数

    • Joint: any

      The mouse joint.

    • frequency: number

      The frequency.

    • dampingRatio: number

      The damping ratio.

    返回 void

    Set the frequency and damping ratio of a mouse joint.

    设置鼠标关节的频率和阻尼比。

  • 参数

    • joint: any

      The mouse joint.

    • x: number

      The x-coordinate of the target position.

    • y: number

      The y-coordinate of the target position.

    返回 void

    Set the target position of a mouse joint.

    设置鼠标关节的目标位置。

  • 参数

    • shape: any

      The polygon shape.

    • x: number

      The x-coordinate of the polygon shape's position.

    • y: number

      The y-coordinate of the polygon shape's position.

    • arr: number[]

      The vertex array of the polygon shape.

    • scaleX: number

      The horizontal scale of the polygon shape.

    • scaleY: number

      The vertical scale of the polygon shape.

    返回 void

    Set the data of a polygon shape.

    设置多边形形状的数据。

  • 参数

    • body: any

      The rigid body.

    • value: boolean

      True if the rigid body allows rotation, false otherwise.

    返回 void

    Set whether a rigid body allows rotation.

    设置刚体是否允许旋转。

  • 参数

    • body: any

      The rigid body.

    • value: boolean

      True if the rigid body allows sleeping, false otherwise.

    返回 void

    Set whether a rigid body allows sleeping.

    设置刚体是否允许休眠。

  • 参数

    • body: any

      The rigid body.

    • value: number

      The angular damping.

    返回 void

    Set the angular damping of a rigid body.

    设置刚体的角阻尼。

  • 参数

    • body: any

      The rigid body.

    • value: number

      The angular velocity.

    返回 void

    Set the angular velocity of a rigid body.

    设置刚体的角速度。

  • 参数

    • body: any

      The rigid body.

    • value: boolean

      True if the rigid body is a bullet, false otherwise.

    返回 void

    Set whether a rigid body is a bullet.

    设置刚体是否为子弹。

  • 参数

    • body: any

      The rigid body.

    • value: number

      The gravity scale.

    返回 void

    Set the gravity scale of a rigid body.

    设置刚体的重力缩放因子。

  • 参数

    • body: any

      The rigid body.

    • value: number

      The linear damping.

    返回 void

    Set the linear damping of a rigid body.

    设置刚体的线性阻尼。

  • 参数

    • body: any

      The rigid body.

    • value: IV2

      The linear velocity.

    返回 void

    Set the linear velocity of a rigid body.

    设置刚体的线性速度。

  • 参数

    • body: any

      The rigid body.

    • massValue: number

      The mass to set.

    • centerofMass: IV2

      The center of mass to set.

    • inertiaValue: number

      The inertia to set.

    • massData: any

      The mass data to set.

    返回 void

    Set the mass of a rigid body.

    设置刚体的质量。