Skip to content

物理引擎 2.0

物理引擎模拟现实对象物理,包括重力、力、关节等。它非常适合需要具有真实对象行为和以此为中心的游戏。

操作

世界时间比例 修改世界时间比例。在需要一个对象时,这将适用于所有使用该行为的对象。

条件

碰撞 检查两个对象是否发生碰撞。

碰撞开始 检查两个对象是否在本帧刚开始碰撞。

碰撞停止 检查两个对象是否在本帧刚停止碰撞。

物理引擎 2.0

模拟现实对象物理,包括重力、力、关节等。

行为操作

添加距离关节 在两个对象之间添加一个距离关节。长度使用 X 上的世界比例转换为米。频率和阻尼比与关节振荡速度及其停止速度相关。

添加摩擦关节 在两个对象之间添加一个摩擦关节。

添加齿轮关节 在两个关节之间添加一个齿轮关节。注意:齿轮关节要求关节是旋转关节或平移关节,并且两个关节都附加到静态体作为第一个对象。

添加电机关节 在两个对象之间添加一个电机关节。位置和角度偏移是相对于第一个对象的。

添加鼠标关节 为一个对象添加鼠标关节(使对象朝特定点移动)。

添加平移关节 在两个对象之间添加一个平移关节。翻译限制使用 X 上的世界比例转换为米。

添加滑轮关节 在两个对象之间添加一个滑轮关节。长度使用 X 上的世界比例转换为米。

添加旋转关节 在固定点向对象添加旋转关节。对象附加为关节中的第二个对象,因此您可以将其用于齿轮关节。

在两个物体之间添加旋转关节 在两个对象之间添加一个旋转关节。参考角度确定初始状态下所考虑的基本角度。

添加绳关节 在两个对象之间添加一个绳关节。最大长度使用 X 上的世界比例转换为米。

添加焊接关节 在两个对象之间添加一个焊接关节。

添加轮关节 在两个对象之间添加一个车轮关节。更高的频率意味着更高的悬挂。阻尼确定振荡,1 的临界阻尼意味着没有振荡。

角阻尼 修改对象的角阻尼。角速度在时间上会有多少减慢。

角速度 修改对象的角速度。

应用角冲量(旋转冲量) 向对象施加一个角冲量(也称为“旋转冲量”)。它会立即改变旋转速度,例如给出一个初始速度。

施加力 向对象施加力以随时间加速。它“加速”一个对象,并且必须在一段时间内每帧使用。

朝向位置施加力 向对象施加移向位置的力,以将其移向位置。它“加速”一个对象,并且必须在一段时间内每帧使用。

施加冲量 向对象施加冲量。它会立即改变速度,例如给出一个初始速度。

朝向位置施加冲量 向对象施加冲量,使其朝向位置移动。它会立即改变速度,例如给出一个初始速度。

施加力(角度) 使用极坐标向对象施加力,以随时间加速。它“加速”一个对象,并且必须在一段时间内每帧使用。

施加冲量(角度) 使用极坐标向对象施加一个冲量。它会立即改变速度,例如给出一个初始速度。

施加转矩(旋转力) 向对象施加一个转矩(也称为“旋转力”)。它会加速对象的旋转,必须在一段时间内每帧使用。

密度 修改对象的密度。物体的密度和体积决定其质量。

距离关节阻尼比 修改距离关节的阻尼比。

距离关节频率 修改距离关节的频率。

距离关节长度 修改距离关节的长度。

启用图层 为对象启用或禁用图层。如果第一个对象的任何图层与第二个对象的任何蒙版匹配,那么两个对象会发生碰撞,反之亦然。

启用蒙版 为对象启用或禁用蒙版。如果第一个对象的任何图层与第二个对象的任何蒙版匹配,则两个对象会发生碰撞,反之亦然。

启用平移关节限制 启用或禁用平移关节限制。

启用平移关节电机 启用或禁用平移关节电机。

启用旋转关节限制 启用或禁用旋转关节角度限制。

启用旋转关节电机 启用或禁用旋转关节电机。

启用车轮关节电机 启用或禁用车轮关节电机。

摩擦 修改对象的摩擦。一个物体相对于另一个物体的运动损失多少能量。两个物体的组合摩擦计算为'sqrt(bodyA.friction * bodyB.friction)'。

摩擦关节最大力 修改摩擦关节的最大力。

摩擦关节最大扭矩 修改摩擦关节的最大扭矩。

齿轮关节比率 修改齿轮关节的比率。

世界重力 修改世界重力。在需要一个对象时,这将应用于使用该行为的所有对象。

重力比例 修改对象的重力比例。施加到对象上的重力是世界重力乘以对象的重力比例。

线性阻尼 修改对象的线性阻尼。移动速度在时间上会有多少减慢。

沿角度设置线性速度 设置沿角度的线性速度。

线性速度 X 修改对象在 X 上的线性速度。

线性速度 Y 修改对象在 Y 上的线性速度。 Motor joint angular offset Modify a motor joint angular offset.

Motor joint correction factor Modify a motor joint correction factor.

Motor joint max force Modify a motor joint maximum force.

Motor joint max torque Modify a motor joint maximum torque.

Motor joint offset Modify a motor joint offset.

Mouse joint damping ratio Set a mouse joint damping ratio.

Mouse joint frequency Set a mouse joint frequency.

Mouse joint max force Set a mouse joint maximum force.

Mouse joint target Set a mouse joint target.

Prismatic joint limits Modify a prismatic joint limits.

Prismatic joint max motor force Modify a prismatic joint maximum motor force.

Prismatic joint motor speed Modify a prismatic joint motor speed.

Remove joint Remove a joint from the scene.

Restitution Modify an object restitution. Energy conservation on collision. The combined restitution from two bodies is calculated as 'max(bodyA.restitution, bodyB.restitution)'.

Revolute joint limits Modify a revolute joint angle limits.

Revolute joint max motor torque Modify a revolute joint maximum motor torque.

Revolute joint motor speed Modify a revolute joint motor speed.

Rope joint max length Modify a rope joint maximum length.

Treat as bullet Treat the object as a bullet. Better collision handling on high speeds at cost of some performance.

Set as dynamic Set an object as dynamic. Is affected by gravity, forces and velocities.

Fixed rotation Enable or disable an object fixed rotation. If enabled the object won't be able to rotate.

Set as kinematic Set an object as kinematic. Is like a static body but can be moved through its velocity.

Sleeping allowed Allow or not an object to sleep. If enabled the object will be able to sleep, improving performance for non-currently-moving objects.

Set as static Set an object as static. Is not affected by gravity, and can't be moved by forces or velocities at all.

Shape scale Modify an object shape scale. It affects custom shape dimensions and shape offset, if custom dimensions are not set the body will be scaled automatically to the object size.

Weld joint damping ratio Modify a weld joint damping ratio.

Weld joint frequency Modify a weld joint frequency.

Wheel joint damping ratio Modify a wheel joint damping ratio.

Wheel joint frequency Modify a wheel joint frequency.

Wheel joint max motor torque Modify a wheel joint maximum motor torque.

Wheel joint motor speed Modify a wheel joint motor speed.

Behavior conditions

Angular damping Test an object angular damping.

Angular velocity Test an object angular velocity.

Density Test an object density.

Friction Test an object friction.

Gravity scale Test an object gravity scale.

World gravity on X axis Compare the world gravity on X axis.

World gravity on Y axis Compare the world gravity on Y axis.

Has fixed rotation Test if an object has fixed rotation.

Is treat as bullet Test if an object is being treat as a bullet.

Is dynamic Test if an object is dynamic.

Is kinematic Test if an object is kinematic.

Is sleeping Test if an object is sleeping.

Is sleeping allowed Test if an object can sleep.

Is static Test if an object is static.

Joint first object Test if an object is the first object on a joint.

Joint reaction force Test a joint reaction force.

Joint reaction torque Test a joint reaction torque.

Joint second object Test if an object is the second object on a joint.

Layer enabled Test if an object has a specific layer enabled.

Linear damping Test an object linear damping.

Linear velocity angle Test an object linear velocity angle.

Linear velocity Test an object linear velocity length.

Linear velocity X Test an object linear velocity on X.

Linear velocity Y Test an object linear velocity on Y.

Mask enabled Test if an object has a specific mask enabled.

Prismatic joint limits enabled Test if a prismatic joint limits are enabled.

Prismatic joint motor enabled Test if a prismatic joint motor is enabled.

Restitution Test an object restitution.

Revolute joint limits enabled Test if a revolute joint limits are enabled.

Revolute joint motor enabled Test if a revolute joint motor is enabled.

World time scale Compare the world time scale.

Wheel joint motor enabled Test if a wheel joint motor is enabled.

Behavior expressions

Expression

Description

Object.Physics2::AngularDamping()

Get the angular damping of an object.

Object.Physics2::AngularVelocity()

Get the angular velocity of an object.

Object.Physics2::Density()

Get the density of an object.

Object.Physics2::DistanceJointDampingRatio(number)

Distance joint damping ratio

🔢 Number

Joint ID

Object.Physics2::DistanceJointFrequency(number)

Distance joint frequency

🔢 Number

Joint ID

Object.Physics2::DistanceJointLength(number)

Distance joint length

🔢 Number

Joint ID

Object.Physics2::Friction()

Get the friction of an object.

Object.Physics2::FrictionJointMaxForce(number)

Friction joint maximum force

🔢 Number

Joint ID

Object.Physics2::FrictionJointMaxTorque(number)

Friction joint maximum torque

🔢 Number

Joint ID

Object.Physics2::GearJointFirstJoint(number)

Gear joint first joint

🔢 Number

Joint ID

Object.Physics2::GearJointRatio(number)

Gear joint ratio

🔢 Number

Joint ID

Object.Physics2::GearJointSecondJoint(number)

Gear joint second joint

🔢 Number

Joint ID

Object.Physics2::GravityScale()

Get the gravity scale of an object.

Object.Physics2::GravityX()

World gravity on X axis

Object.Physics2::GravityY()

World gravity on Y axis

Object.Physics2::Inertia()

Return the rotational inertia of the object (in kilograms * meters * meters)

Object.Physics2::JointFirstAnchorX(number)

Joint first anchor X

🔢 Number

Joint ID

Object.Physics2::JointFirstAnchorY(number)

Joint first anchor Y

🔢 Number

Joint ID

Object.Physics2::JointReactionForce(number)

Joint reaction force

🔢 Number

Joint ID

Object.Physics2::JointReactionTorque(number)

Joint reaction torque

🔢 Number

Joint ID

Object.Physics2::JointSecondAnchorX(number)

Joint second anchor X

🔢 Number

Joint ID

Object.Physics2::JointSecondAnchorY(number)

Joint second anchor Y

🔢 Number

Joint ID

Object.Physics2::LinearDamping()

Get the linear damping of an object.

Object.Physics2::LinearVelocity()

Get the linear velocity of an object.

Object.Physics2::LinearVelocityAngle()

Get the linear velocity angle of an object.

Object.Physics2::LinearVelocityX()

Get the linear velocity of an object on X axis.

Object.Physics2::LinearVelocityY()

Get the linear velocity of an object on Y axis.

Object.Physics2::Mass()

Return the mass of the object (in kilograms)

Object.Physics2::MassCenterX()

Mass center X

Object.Physics2::MassCenterY()

Mass center Y

Object.Physics2::MotorJointAngularOffset(number)

Motor joint angular offset

🔢 Number

Joint ID

Object.Physics2::MotorJointCorrectionFactor(number)

Motor joint correction factor

🔢 Number

Joint ID

Object.Physics2::MotorJointMaxForce(number)

Motor joint maximum force

🔢 Number

Joint ID

Object.Physics2::MotorJointMaxTorque(number)

Motor joint maximum torque

🔢 Number

Joint ID

Object.Physics2::MotorJointOffsetX(number)

Motor joint offset X

🔢 Number

Joint ID

Object.Physics2::MotorJointOffsetY(number)

Motor joint offset Y

🔢 Number

Joint ID

Object.Physics2::MouseJointDampingRatio(number)

Mouse joint damping ratio

🔢 Number

Joint ID

Object.Physics2::MouseJointFrequency(number)

Mouse joint frequency

🔢 Number

Joint ID

Object.Physics2::MouseJointMaxForce(number)

Mouse joint maximum force

🔢 Number

Joint ID

Object.Physics2::MouseJointTargetX(number)

Mouse joint target X

🔢 Number

Joint ID

Object.Physics2::MouseJointTargetY(number)

Mouse joint target Y

🔢 Number

Joint ID

Object.Physics2::PrismaticJointAxisAngle(number)

Prismatic joint axis angle

🔢 Number

Joint ID

Object.Physics2::PrismaticJointMaxMotorForce(number)

Prismatic joint maximum motor force

🔢 Number

Joint ID

Object.Physics2::PrismaticJointMaxTranslation(number)

Prismatic joint maximum translation

🔢 Number

Joint ID

Object.Physics2::PrismaticJointMinTranslation(number)

Prismatic joint minimum translation

🔢 Number

Joint ID

Object.Physics2::PrismaticJointMotorForce(number)

Prismatic joint motor force

🔢 Number

Joint ID

Object.Physics2::PrismaticJointMotorSpeed(number)

Prismatic joint motor speed

🔢 Number

Joint ID

Object.Physics2::PrismaticJointReferenceAngle(number)

Prismatic joint reference angle

🔢 Number

Joint ID

Object.Physics2::PrismaticJointSpeed(number)

Prismatic joint speed

🔢 Number

Joint ID

Object.Physics2::PrismaticJointTranslation(number)

Prismatic joint current translation

🔢 Number

Joint ID

Object.Physics2::PulleyJointFirstGroundAnchorX(number)

Pulley joint first ground anchor X

🔢 Number

Joint ID

Object.Physics2::PulleyJointFirstGroundAnchorY(number)

Pulley joint first ground anchor Y

🔢 Number

Joint ID

Object.Physics2::PulleyJointFirstLength(number)

Pulley joint first length

🔢 Number

Joint ID

Object.Physics2::PulleyJointRatio(number)

Pulley joint ratio

🔢 Number

Joint ID

Object.Physics2::PulleyJointSecondGroundAnchorX(number)

Pulley joint second ground anchor X

🔢 Number

Joint ID

Object.Physics2::PulleyJointSecondGroundAnchorY(number)

Pulley joint second ground anchor Y

🔢 Number

Joint ID

Object.Physics2::PulleyJointSecondLength(number)

Pulley joint second length

🔢 Number

Joint ID

Object.Physics2::Restitution()

Get the restitution of an object.

Object.Physics2::RevoluteJointAngle(number)

Revolute joint current angle

🔢 Number

Joint ID

Object.Physics2::RevoluteJointMaxAngle(number)

Revolute joint maximum angle

🔢 Number

Joint ID

Object.Physics2::RevoluteJointMaxMotorTorque(number)

Revolute joint maximum motor torque

🔢 Number

Joint ID

Object.Physics2::RevoluteJointMinAngle(number)

Revolute joint minimum angle

🔢 Number

Joint ID

Object.Physics2::RevoluteJointMotorSpeed(number)

Revolute joint motor speed

🔢 Number

Joint ID

Object.Physics2::RevoluteJointMotorTorque(number)

Revolute joint motor torque

🔢 Number

Joint ID

Object.Physics2::RevoluteJointReferenceAngle(number)

Revolute joint reference angle

🔢 Number

Joint ID

Object.Physics2::RevoluteJointSpeed(number)

Revolute joint angular speed

🔢 Number

Joint ID

Object.Physics2::RopeJointMaxLength(number)

Rope joint maximum length

🔢 Number

Joint ID

Object.Physics2::TimeScale()

World time scale

Object.Physics2::WeldJointDampingRatio(number)

Weld joint damping ratio

🔢 Number

Joint ID

Object.Physics2::WeldJointFrequency(number)

Weld joint frequency

🔢 Number

Joint ID

Object.Physics2::WeldJointReferenceAngle(number)

Weld joint reference angle

🔢 Number

Joint ID

Object.Physics2::WheelJointAxisAngle(number)

Wheel joint axis angle

🔢 Number

Joint ID

Object.Physics2::WheelJointDampingRatio(number)

Wheel joint damping ratio

🔢 Number

Joint ID

Object.Physics2::WheelJointFrequency(number)

Wheel joint frequency

🔢 Number

Joint ID

Object.Physics2::WheelJointMaxMotorTorque(number)

Wheel joint maximum motor torque

🔢 Number

Joint ID

Object.Physics2::WheelJointMotorSpeed(number)

Wheel joint motor speed

🔢 Number

Joint ID

Object.Physics2::WheelJointMotorTorque(number)

Wheel joint motor torque

🔢 Number

Joint ID

Object.Physics2::WheelJointSpeed(number)

Wheel joint speed

🔢 Number

Joint ID

Object.Physics2::WheelJointTranslation(number)

轮接头当前平移