Difference between revisions of "R3d.Body"

From GiderosMobile
 
(6 intermediate revisions by the same user not shown)
Line 29: Line 29:
 
[[r3d.Body:enableGravity]] ''enables or disables gravity force on the body''<br/><!--GIDEROSMTD:r3d.Body:enableGravity(enable) enables or disables gravity force on the body-->
 
[[r3d.Body:enableGravity]] ''enables or disables gravity force on the body''<br/><!--GIDEROSMTD:r3d.Body:enableGravity(enable) enables or disables gravity force on the body-->
 
[[r3d.Body:getAngularDamping]] ''gets the body angular damping''<br/><!--GIDEROSMTD:r3d.Body:getAngularDamping() gets the body angular damping-->
 
[[r3d.Body:getAngularDamping]] ''gets the body angular damping''<br/><!--GIDEROSMTD:r3d.Body:getAngularDamping() gets the body angular damping-->
 +
[[r3d.Body:getAngularLockAxisFactor]] ''gets the angular lock axis factor of a rigid body''<br/><!--GIDEROSMTD:r3d.Body:getAngularLockAxisFactor() gets the angular lock axis factor of a rigid body-->
 
[[r3d.Body:getAngularVelocity]] ''gets the body angular velocity''<br/><!--GIDEROSMTD:r3d.Body:getAngularVelocity() gets the body angular velocity-->
 
[[r3d.Body:getAngularVelocity]] ''gets the body angular velocity''<br/><!--GIDEROSMTD:r3d.Body:getAngularVelocity() gets the body angular velocity-->
 +
[[r3d.Body:getForce]] ''gets the body linear force''<br/><!--GIDEROSMTD:r3d.Body:getForce() gets the body linear force-->
 
[[r3d.Body:getLinearDamping]] ''gets the body linear damping''<br/><!--GIDEROSMTD:r3d.Body:getLinearDamping() gets the body linear damping-->
 
[[r3d.Body:getLinearDamping]] ''gets the body linear damping''<br/><!--GIDEROSMTD:r3d.Body:getLinearDamping() gets the body linear damping-->
 +
[[r3d.Body:getLinearLockAxisFactor]] ''gets the linear lock axis factor of a rigid body''<br/><!--GIDEROSMTD:r3d.Body:getLinearLockAxisFactor() gets the linear lock axis factor of a rigid body-->
 
[[r3d.Body:getLinearVelocity]] ''gets the body linear velocity''<br/><!--GIDEROSMTD:r3d.Body:getLinearVelocity() gets the body linear velocity-->
 
[[r3d.Body:getLinearVelocity]] ''gets the body linear velocity''<br/><!--GIDEROSMTD:r3d.Body:getLinearVelocity() gets the body linear velocity-->
 
[[r3d.Body:getMass]] ''gets the body mass''<br/><!--GIDEROSMTD:r3d.Body:getMass() gets the body mass-->
 
[[r3d.Body:getMass]] ''gets the body mass''<br/><!--GIDEROSMTD:r3d.Body:getMass() gets the body mass-->
 +
[[r3d.Body:getTorque]] ''gets the body rotational force''<br/><!--GIDEROSMTD:r3d.Body:getTorque() gets the body rotational force-->
 
[[r3d.Body:getTransform]] ''gets the body transform (position and rotation) matrix''<br/><!--GIDEROSMTD:r3d.Body:getTransform() gets the body transform (position and rotation) matrix-->
 
[[r3d.Body:getTransform]] ''gets the body transform (position and rotation) matrix''<br/><!--GIDEROSMTD:r3d.Body:getTransform() gets the body transform (position and rotation) matrix-->
 
[[r3d.Body:raycast]] ''performs a ray cast on the body''<br/><!--GIDEROSMTD:r3d.Body:raycast(sx,sy,sz,ex,ey,ez) performs a ray cast on the body-->
 
[[r3d.Body:raycast]] ''performs a ray cast on the body''<br/><!--GIDEROSMTD:r3d.Body:raycast(sx,sy,sz,ex,ey,ez) performs a ray cast on the body-->
 +
[[r3d.Body:resetForce]] ''resets the body linear forces''<br/><!--GIDEROSMTD:r3d.Body:resetForce() resets the body linear forces-->
 +
[[r3d.Body:resetTorque]] ''resets the body angular forces''<br/><!--GIDEROSMTD:r3d.Body:resetTorque() resets the body angular forces-->
 
[[r3d.Body:setAngularDamping]] ''sets the body angular damping''<br/><!--GIDEROSMTD:r3d.Body:setAngularDamping(number) sets the body angular damping-->
 
[[r3d.Body:setAngularDamping]] ''sets the body angular damping''<br/><!--GIDEROSMTD:r3d.Body:setAngularDamping(number) sets the body angular damping-->
 +
[[r3d.Body:setAngularLockAxisFactor]] ''restricts the angular motion of a rigid body''<br/><!--GIDEROSMTD:r3d.Body:setAngularLockAxisFactor(number,number,number) restricts the angular motion of a rigid body-->
 
[[r3d.Body:setAngularVelocity]] ''sets the body angular velocity''<br/><!--GIDEROSMTD:r3d.Body:setAngularVelocity(number) sets the body angular velocity-->
 
[[r3d.Body:setAngularVelocity]] ''sets the body angular velocity''<br/><!--GIDEROSMTD:r3d.Body:setAngularVelocity(number) sets the body angular velocity-->
[[r3d.Body:setIsAllowedToSleep]] ''allows or disallows a body to sleep''<br/><!--GIDEROSMTD:r3d.Body:setIsAllowedToSleep(allowed) allows or disallows a body to sleep-->
+
[[r3d.Body:setIsActive]] ''sets a body to active''<br/><!--GIDEROSMTD:r3d.Body:setIsActive(bool) sets a body to active-->
 +
[[r3d.Body:setIsAllowedToSleep]] ''allows or disallows a body to sleep''<br/><!--GIDEROSMTD:r3d.Body:setIsAllowedToSleep(bool) allows or disallows a body to sleep-->
 
[[r3d.Body:setIsSleeping]] ''sets a body to sleep''<br/><!--GIDEROSMTD:r3d.Body:setIsSleeping(bool) sets a body to sleep-->
 
[[r3d.Body:setIsSleeping]] ''sets a body to sleep''<br/><!--GIDEROSMTD:r3d.Body:setIsSleeping(bool) sets a body to sleep-->
 
[[r3d.Body:setLinearDamping]] ''sets the body linear damping''<br/><!--GIDEROSMTD:r3d.Body:setLinearDamping(number) sets the body linear damping-->
 
[[r3d.Body:setLinearDamping]] ''sets the body linear damping''<br/><!--GIDEROSMTD:r3d.Body:setLinearDamping(number) sets the body linear damping-->
 +
[[r3d.Body:setLinearLockAxisFactor]] ''restricts the linear motion of a rigid body''<br/><!--GIDEROSMTD:r3d.Body:setLinearLockAxisFactor(number,number,number) restricts the linear motion of a rigid body-->
 
[[r3d.Body:setLinearVelocity]] ''sets the body linear velocity''<br/><!--GIDEROSMTD:r3d.Body:setLinearVelocity(number) sets the body linear velocity-->
 
[[r3d.Body:setLinearVelocity]] ''sets the body linear velocity''<br/><!--GIDEROSMTD:r3d.Body:setLinearVelocity(number) sets the body linear velocity-->
 
[[r3d.Body:setMass]] ''sets the mass of the body''<br/><!--GIDEROSMTD:r3d.Body:setMass(number) sets the mass of the body-->
 
[[r3d.Body:setMass]] ''sets the mass of the body''<br/><!--GIDEROSMTD:r3d.Body:setMass(number) sets the mass of the body-->
 +
[[r3d.Body:setSprite]] ''sets the body Sprite''<br/><!--GIDEROSMTD:r3d.Body:setSprite(sprite) sets the body Sprite-->
 
[[r3d.Body:setTransform]] ''sets the body transform matrix''<br/><!--GIDEROSMTD:r3d.Body:setTransform(transform) sets the body transform matrix-->
 
[[r3d.Body:setTransform]] ''sets the body transform matrix''<br/><!--GIDEROSMTD:r3d.Body:setTransform(transform) sets the body transform matrix-->
 
[[r3d.Body:setType]] ''sets the body type''<br/><!--GIDEROSMTD:r3d.Body:setType(type) sets the body type-->
 
[[r3d.Body:setType]] ''sets the body type''<br/><!--GIDEROSMTD:r3d.Body:setType(type) sets the body type-->
 
[[r3d.Body:testPointInside]] ''checks if a point is inside the body''<br/><!--GIDEROSMTD:r3d.Body:testPointInside(x,y,z) checks if a point is inside the body-->
 
[[r3d.Body:testPointInside]] ''checks if a point is inside the body''<br/><!--GIDEROSMTD:r3d.Body:testPointInside(x,y,z) checks if a point is inside the body-->
 +
[[r3d.Body:updateMassPropertiesFromColliders]] ''updates the body mass based on its colliders''<br/><!--GIDEROSMTD:r3d.Body:updateMassPropertiesFromColliders() updates the body mass based on its colliders-->
  
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|

Latest revision as of 00:01, 19 December 2025

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.pngPlatform linux.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:applyLocalForceAtCenterOfMass applies a force to this body
r3d.Body:applyLocalForceAtLocalPosition applies a force to this body
r3d.Body:applyLocalForceAtWorldPosition applies a force to this body
r3d.Body:applyLocalTorque applies a torque to this body
r3d.Body:applyWorldForceAtCenterOfMass applies a force to this body
r3d.Body:applyWorldForceAtLocalPosition applies a force to this body
r3d.Body:applyWorldForceAtWorldPosition applies a force to this body
r3d.Body:applyWorldTorque 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:getAngularLockAxisFactor gets the angular lock axis factor of a rigid body
r3d.Body:getAngularVelocity gets the body angular velocity
r3d.Body:getForce gets the body linear force
r3d.Body:getLinearDamping gets the body linear damping
r3d.Body:getLinearLockAxisFactor gets the linear lock axis factor of a rigid body
r3d.Body:getLinearVelocity gets the body linear velocity
r3d.Body:getMass gets the body mass
r3d.Body:getTorque gets the body rotational force
r3d.Body:getTransform gets the body transform (position and rotation) matrix
r3d.Body:raycast performs a ray cast on the body
r3d.Body:resetForce resets the body linear forces
r3d.Body:resetTorque resets the body angular forces
r3d.Body:setAngularDamping sets the body angular damping
r3d.Body:setAngularLockAxisFactor restricts the angular motion of a rigid body
r3d.Body:setAngularVelocity sets the body angular velocity
r3d.Body:setIsActive sets a body to active
r3d.Body:setIsAllowedToSleep allows or disallows a body to sleep
r3d.Body:setIsSleeping sets a body to sleep
r3d.Body:setLinearDamping sets the body linear damping
r3d.Body:setLinearLockAxisFactor restricts the linear motion of a rigid body
r3d.Body:setLinearVelocity sets the body linear velocity
r3d.Body:setMass sets the mass of the body
r3d.Body:setSprite sets the body Sprite
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
r3d.Body:updateMassPropertiesFromColliders updates the body mass based on its colliders

Constants

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


ReactPhysics3D