"Lan Unity Development Foundation three" Class 14 rigid body
first, Rigid Body
Physical Engine:
Physical engine can realistically simulate physical effects
In Unity, NVIDIA 's PhysX physics engine is used
in the use rigidbody in Unity to let game objects be controlled by the physics engine
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/CA/wKioL1fh-X-zrw3QAAog59NPQFY673.png-wh_500x0-wm_3 -wmp_4-s_228553750.png "title=" Unity Engine Lesson 14 rigid body 281.png "alt=" wkiol1fh-x-zrw3qaaog59npqfy673.png-wh_50 "/>
in the demo in Unity-create a Plane-dye green-create a Cube, Hover-dye red!
under normal circumstances The cube does not float, because thecube does not hover because it is affected by Gravity. Then create a rigid body component--rigidbody.
selected Cube--find rigidbody--add to cube --then rerun the scene, our Cube From falling from the air to the Ground.
Rigidbody Parameters
Mass: Mass 1 is only used to determine the inertia of the object, the mass of the object is very light, the impact will fly very far.
Drag: For air resistance, If you want the game object to fall slowly, you can adjust the air resistance
Angular Drag: Angular resistance, used when the object rotates
Use Gravity: Is it affected by gravity ?
is kinematic: use kinematics, not controlled by the physics engine
Interpolate: Difference value None difference value Interpolate Internal difference extrapolate heterodyne value
Constraints Detection: Collision detection discrete discrete collision detection (for General Use) continuous continuous collision Detection Continuous Dynamic continuous Collision detection
Constraints:Freeze Position,Freeze Rotation
Freeze Position
Freeze Rotation
Give Cube Add a script Test, and then we look at some of the properties in the rigid body:
usingunityengine;
usingsystem.collections;
public class Test : Monobehaviour {
voidStart () {
RigidbodyRB = getcomponent<Rigidbody> ();
floatmass= rb.mass;// Quality
floatdrag= rb.drag;// air resistance
rb.angulardrag;// angular resistance
rb.usegravity;// Whether the current game object is affected by gravity
rb.iskinematic;// whether to use kinematics
rb.freezerotation;// whether to freeze the rotation of the game object
}
}
Recommended Video lecturer Blog: http://11165165.blog.51cto.com/
"Lan Unity Development Foundation three" Class 14 rigid body