Click or drag to resize

Physical Objects Creation 2D

2D Game EngineManual / Content Creation / Physical Objects Creation 2DBase Types

Physical Objects Creation 2D

NeoAxis Engine comes with a rich set of tools for working with 2D body physics.

Contents
Display physical objects

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.

Screenshot999999999999221 2.png
Rigid Body 2D

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.

Screenshot999999999999220.png

One can create Rigid Body 2D by picking required figure, and dropping in the scene.

Screenshot999999999866 2.png

Also, body settings can be modified. For example one can made body dynamical.

Screenshot999999999867 2.png

In addition to simple bodies, one can create compound rigid bodies. That can be achieved via placing additional shapes to the body.

Screenshot999999999868 2.png
Name Description
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.
Add Collision

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.

Screenshot999999999869.png

One can see that body now has nested object Collision Body, which could be tuned.

Screenshot999999999870 2.png
Constraint

To create constraint one needs to select two bodies, and click Add Constraint in context menu. Next constraint types are supported:

  • Revolute Constraint 2D - A revolute joint constrains to bodies to share a common point while they are free to rotate about the point.
  • Prismatic Constraint 2D - A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in body A. Relative rotation is prevented.
  • Distance Constraint 2D - A distance joint rains two points on two bodies to remain at a fixed distance from each other.
  • Weld Constraint 2D - A weld joint essentially glues two bodies together. The joint is soft constraint based, which means the two bodies will move relative to each other.
  • Fixed Constraint 2D - A joint hard constraints two bodies.
Screenshot999999999999231.png

After creation, constraint can be moved to desired place, its settings can be adjusted.

Screenshot999999999999232.png
Sensor 2D

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'.

Screenshot999999999999179.png
See also
2D Game EngineBase Types