Unity 五、物理系统(一)Rigidbody(刚体)
Mass | 质量 | 物体的质量。 |
Drag | 阻力 | 影响位置运动的阻力系数。 |
Angular Drag | 角阻力 | 影响旋转运动的阻力系数。 |
Use Gravity | 使用重力 | 物体是否受到重力的影响。 |
Is Kinematic | 是运动学的 | 是否受物理系统影响。 |
Interpolate None Interpolate Extrapolate |
插值 无 插值 外推 |
定义游戏对象的运动是如何在物理更新之间插入的(当运动趋于颠簸时有用)。 |
Collision Detection Discrete Continuous Continuous Dynamic Continuous Speculative |
碰撞检测 离散的 持续 连续动态 连续投机 |
定义碰撞器之间是如何检测碰撞的。 |
Constraints Freeze Position Freeze Rotation |
约束 冻结位置 冻结旋转 |
限制物体受力后移动与旋转的轴向 |
Info | 信息 | 当前设置信息 |
属性
public Vector3 angularVelocity { get; set; } | The angular velocity vector of the rigidbody measured in radians per second. | 刚体角速度矢量,单位为弧度/秒。 |
public float drag { get; set; } | The drag of the object. | 物体的阻力。 |
public float angularDrag { get; set; } | The angular drag of the object. | 物体的角阻力。 |
public float mass { get; set; } | The mass of the rigidbody. |
刚体的质量。 |
public bool useGravity { get; set; } | Controls whether gravity affects this rigidbody. | 控制重力是否影响刚体。 |
public float maxDepenetrationVelocity { get; set; } | Maximum velocity of a rigidbody when moving out of penetrating state. | 刚体在脱离穿透状态时的最大速度。 |
public bool isKinematic { get; set; } | Controls whether physics affects the rigidbody. | 控制物理是否影响刚体。 |
public bool freezeRotation { get; set; } | Controls whether physics will change the rotation of the object. | 控制物理是否会改变物体的旋转。 |
public RigidbodyConstraints constraints { get; set; } | Controls which degrees of freedom are allowed for the simulation of this Rigidbody. | 控制该刚体的模拟允许的自由度。 |
public CollisionDetectionMode collisionDetectionMode { get; set; } | The Rigidbody's collision detection mode. | 刚体的碰撞检测模式。 |
public Vector3 centerOfMass { get; set; } | The center of mass relative to the transform's origin. | 相对于transform原点的质量中心。 |
public Vector3 worldCenterOfMass { get; } | The center of mass of the rigidbody in world space (Read Only). | 刚体在世界空间中的质量中心(只读)。 |
public Quaternion inertiaTensorRotation { get; set; } | The rotation of the inertia tensor. | 转动的惯性张量。 |
public Vector3 inertiaTensor { get; set; } | The diagonal inertia tensor of mass relative to the center of mass. | 质量相对于质心的对角惯性张量。 |
public bool detectCollisions { get; set; } | Should collision detection be enabled? (By default always enabled). | 是否应该启用碰撞检测?(默认情况下总是启用)。 |
public Vector3 position { get; set; } | The position of the rigidbody. |
刚体的位置。 |
public Quaternion rotation { get; set; } | The rotation of the rigidbody. |
刚体的旋转。 |
public RigidbodyInterpolation interpolation { get; set; } | Interpolation allows you to smooth out the effect of running physics at a fixed frame rate. | 插值:可以起到运动时平滑的效果,运行物理在一个固定的帧率。 |
public int solverIterations { get; set; } | The solverIterations determines how accurately Rigidbody joints and collision contacts are resolved. Overrides Physics.defaultSolverIterations. Must be positive. | |
public int solverVelocityIterations { get; set; } | The solverVelocityIterations affects how how accurately Rigidbody joints and collision contacts are resolved. Overrides Physics.defaultSolverVelocityIterations. Must be positive. | |
public Vector3 velocity { get; set; } | The velocity vector of the rigidbody. |
刚体的速度矢量。 |
public float sleepThreshold { get; set; } | The mass-normalized energy threshold, below which objects start going to sleep. | 质量归一化的能量阈值,低于这个阈值,物体就会进入睡眠状态。 |
public float maxAngularVelocity { get; set; } | The maximimum angular velocity of the rigidbody. (Default 7) range { 0, infinity}. | 刚体的最大角速度。(默认7)范围{0,无穷大}。 |
方法
public void AddExplosionForce(float explosionForce, Vector3 explosionPosition, float explosionRadius, [DefaultValue("0.0F")] float upwardsModifier, [DefaultValue("ForceMode.Force")] ForceMode mode);
摘要: Applies a force to a rigidbody that simulates explosion effects.对模拟爆炸效果的刚体施加一个力。
参数:
- explosionForce:The force of the explosion (which may be modified by distance).
- 爆炸力(可由距离改变)。
- explosionPosition:The centre of the sphere within which the explosion has its effect.
- 爆炸产生影响的球体的中心。
- explosionRadius:The radius of the sphere within which the explosion has its effect.
- 爆炸产生影响的球体的半径。
- upwardsModifier:Adjustment to the apparent position of the explosion to make it seem to lift objects.
- 调整到爆炸的明显位置,使其看起来能举起物体。
- mode:The method used to apply the force to its targets.
- 把力施加到目标上的方法。
public void AddExplosionForce(float explosionForce, Vector3 explosionPosition, float explosionRadius, float upwardsModifier);
摘要:Applies a force to a rigidbody that simulates explosion effects.对模拟爆炸效果的刚体施加一个力。
参数:
- explosionForce:The force of the explosion (which may be modified by distance).
- 爆炸力(可由距离改变)。
- explosionPosition:The centre of the sphere within which the explosion has its effect.
- 爆炸产生影响的球体的中心。
- explosionRadius:The radius of the sphere within which the explosion has its effect.
- 爆炸产生影响的球体的半径。
- upwardsModifier:Adjustment to the apparent position of the explosion to make it seem to lift objects.
- 调整到爆炸的明显位置,使其看起来能举起物体。
public void AddExplosionForce(float explosionForce, Vector3 explosionPosition, float explosionRadius);
摘要:Applies a force to a rigidbody that simulates explosion effects.对模拟爆炸效果的刚体施加一个力。
参数:
- explosionForce:The force of the explosion (which may be modified by distance).
- 爆炸力(可由距离改变)。
- explosionPosition:The centre of the sphere within which the explosion has its effect.
- 爆炸产生影响的球体的中心。
- explosionRadius:The radius of the sphere within which the explosion has its effect.
- 爆炸产生影响的球体的半径。