R3d.Body

From GiderosMobile
Revision as of 22:05, 17 December 2020 by MoKaLux (talk | contribs) (update to r3d v0.8)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2019.10

Description

Once the dynamics world has been created, you can create rigid bodies into the world.

A rigid body represents an object that you want to simulate in the world. It has a mass, a position, an orientation, a type, and one or several collision shapes. You can also create joints between the bodies in the world.

The dynamics world will compute collisions between the bodies and will update the bodies position and orientation accordingly every time step.

In ReactPhysics3D, the RigidBody class (which inherits from the CollisionBody class) is used to describe a rigid body.

Methods

r3d.Body:applyForce applies a force to this body
r3d.Body:applyTorque applies a torque to this body
r3d.Body:createFixture creates a new fixture
r3d.Body:destroyFixture destroys a fixture
r3d.Body:enableGravity enables or disables gravity force on the body
r3d.Body:getAngularDamping gets the body angular damping
r3d.Body:getAngularVelocity gets the body angular velocity
r3d.Body:getLinearDamping gets the body linear damping
r3d.Body:getLinearVelocity gets the body linear velocity
r3d.Body:getMass gets the body mass
r3d.Body:getTransform gets the body transform (position and rotation) matrix
r3d.Body:raycast performs a ray cast on the body
r3d.Body:setAngularDamping sets the body angular damping
r3d.Body:setAngularVelocity sets the body angular velocity
r3d.Body:setIsAllowedToSleep allows or disallows a body to sleep
r3d.Body:setLinearDamping sets the body linear damping
r3d.Body:setLinearVelocity sets the body linear velocity
r3d.Body:setMass sets the mass of the body
r3d.Body:setTransform sets the body transform matrix
r3d.Body:setType sets the body type
r3d.Body:testPointInside checks if a point is inside the body

Constants

r3d.Body.STATIC_BODY
r3d.Body.KINEMATIC_BODY
r3d.Body.DYNAMIC_BODY


ReactPhysics3D