Physical Objects Creation 2D
NeoAxis Engine comes with a rich set of tools for working with 2D body physics.
Physical objects are not displayed in the editor by default. In order to enable visualization, one needs to go to Scene Editor tab in Ribbon, and press Development Data, turn on Physical Objects checkbox.
For a nice overview of rigid bodies and constraints one can take a look at 'Physics rigid body 2D.scene' file, which can be found at 'Assets\Samples\Starter Content\Scenes'.
In order to run simulation, one should press Play button in Ribbon or in Quick Access Toolbar.
One can create Rigid Body 2D by picking required figure, and dropping in the scene.
Also, body settings can be modified. For example one can made body dynamical.
In addition to simple bodies, one can create compound rigid bodies. That can be achieved via placing additional shapes to the body.
|Motion Type||The type of motion used.|
|Mass||The mass of the rigidbody.|
|Inertia||Gets or sets the rotational inertia of the body about the local origin.|
|Local Center||Gets or sets the local position of the center of mass.|
|Enable Gravity||Whether the rigidbody is affected by the gravity.|
|Linear Damping||The linear reduction of velocity over time.|
|Angular Damping||The angular reduction of velocity over time.|
|Fixed Rotation||Whether the body to have fixed rotation.|
|Allow Sleep||Allows sleep the body.|
|CCD||Gets or sets a value indicating whether this body should be included in the CCD solver.|
|Linear Velocity||The initial linear velocity of the body.|
|Angular Velocity||The initial angular velocity of the body.|
|Contacts Display||Whether to display collected collision contacts data.|
|Active||Gets the sleep state of the body. A sleeping body has very low CPU cost.|
Another way to create rigid body is to press Add Collision button in Ribbon or via context menu. This works best when one need to add physical body to existing object in the scene.
One can see that body now has nested object Collision Body, which could be tuned.
To create constraint one needs to select two bodies, and click Add Constraint in context menu. Next constraint types are supported:
After creation, constraint can be moved to desired place, its settings can be adjusted.
Sensor 2D used to tune up event firing when bodies get into specific area.
For a nice overview of sensors one can take a look at 'Sensors 2D.scene' file, which can be found at 'Assets\Samples\Starter Content\Scenes'.