"Lan Unity Development Foundation three" Class 14 rigid body

Source: Internet
Author: User

"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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.