Difference between revisions of "R3d.World"

From GiderosMobile
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
<languages/>
 
<!-- GIDEROSOBJ:r3d.World -->
 
<!-- GIDEROSOBJ:r3d.World -->
 
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
 
'''<translate>Supported platforms</translate>:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/>
 
'''<translate>Available since</translate>:''' Gideros 2019.10<br/>
 
'''<translate>Available since</translate>:''' Gideros 2019.10<br/>
 +
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 +
A dynamics world is used to automatically simulate the motion of your bodies using the world physics.
 +
 +
Bodies will be automatically moved using collisions, joints and forces. You do not have to move the bodies manually (but you still can if needed).
 +
 +
The dynamics world will contain the bodies and joints that you create. You will then be able to run your simulation across time by updating the world at each frame.
 +
 +
The DynamicsWorld class (which inherits from the CollisionWorld class) represents a dynamics world in the ReactPhysics3D library.
 +
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== <translate>Methods</translate> ===
 
=== <translate>Methods</translate> ===
[[Special:MyLanguage/r3d.World.new|r3d.World.new]] ''<translate>create a new world</translate>''<br/><!-- GIDEROSMTD:r3d.World.new(gravityX,gravityY,gravityZ) create a 3D physics world -->
+
[[Special:MyLanguage/r3d.World.new|r3d.World.new]] ''<translate>creates a new world</translate>''<br/>
[Special:MyLanguage/r3d.World:createBody|r3d.World:createBody]] ''<translate>create a new body</translate>''<br/><!-- GIDEROSMTD:r3d.World:createBody(transform) create a new body -->
+
<!-- GIDEROSMTD:r3d.World.new(gravityX,gravityY,gravityZ) creates a 3D physics world -->
[[Special:MyLanguage/r3d.World:destroyBody|r3d.World:destroyBody]] ''<translate>destroy a body</translate>''<br/><!-- GIDEROSMTD:r3d.World:destroyBody(body) destroy a body -->
+
[[Special:MyLanguage/r3d.World:createBody|r3d.World:createBody]] ''<translate>creates a new body</translate>''<br/>
[[Special:MyLanguage/r3d.World:step|r3d.World:step]] ''<translate>Step the world</translate>''<br/><!-- GIDEROSMTD:r3d.World:step(time) step the world -->
+
<!-- GIDEROSMTD:r3d.World:createBody(transform) creates a new body -->
[[Special:MyLanguage/r3d.World:raycast|r3d.World:raycast]] ''<translate>perform a ray cast on the world</translate>''<br/><!-- GIDEROSMTD:r3d.World:raycast(sx,sy,sz,ex,ey,ez,callback,category) perform a ray cast on the world -->
+
[[Special:MyLanguage/r3d.World:destroyBody|r3d.World:destroyBody]] ''<translate>destroys a body</translate>''<br/>
[[Special:MyLanguage/r3d.World:testOverlap|r3d.World:testOverlap]] ''<translate>check if two bodies overlap</translate>''<br/><!-- GIDEROSMTD:r3d.World:testOverlap(bodyA,bodyB) check if two bodies overlap -->
+
<!-- GIDEROSMTD:r3d.World:destroyBody(body) destroys a body -->
[[Special:MyLanguage/r3d.World:testAABBOverlap|r3d.World:testAABBOverlap]] ''<translate>check if two bodies AABB overlap</translate>''<br/><!-- GIDEROSMTD:r3d.World:testAABBOverlap(bodyA,bodyB) check if two bodies AABB overlap -->
+
[[Special:MyLanguage/r3d.World:step|r3d.World:step]] ''<translate>steps the world</translate>''<br/>
[[Special:MyLanguage/r3d.World:testCollision|r3d.World:testCollision]] ''<translate>check collisions</translate>''<br/><!-- GIDEROSMTD:r3d.World:testCollision([bodyA,[bodyB,]]callback[,category]) check collisions -->
+
<!-- GIDEROSMTD:r3d.World:step(time) steps the world -->
[[Special:MyLanguage/r3d.World:setEventListener|r3d.World:setEventListener]] ''<translate>set the event listener for collisions in the world</translate>''<br/><!-- GIDEROSMTD:r3d.World:setEventListener(listener) set the event listener for collisions in the world -->
+
[[Special:MyLanguage/r3d.World:raycast|r3d.World:raycast]] ''<translate>performs a ray cast on the world</translate>''<br/>
[[Special:MyLanguage/r3d.World:createBallAndSocketJoint|r3d.World:createBallAndSocketJoint]] <br/><!-- GIDEROSMTD:r3d.World:createBallAndSocketJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,params) -->
+
<!-- GIDEROSMTD:r3d.World:raycast(sx,sy,sz,ex,ey,ez,callback,category) performs a ray cast on the world -->
[[Special:MyLanguage/r3d.World:createHingeJoint|r3d.World:createHingeJoint]] <br/><!-- GIDEROSMTD:r3d.World:createHingeJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,axisX,axisY,axisZ,params) -->
+
[[Special:MyLanguage/r3d.World:testAABBOverlap|r3d.World:testAABBOverlap]] ''<translate>checks if two bodies AABB overlap</translate>''<br/>
[[Special:MyLanguage/r3d.World:createSliderJoint|r3d.World:createSliderJoint]] <br/><!-- GIDEROSMTD:r3d.World:createSliderJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,axisX,axisY,axisZ,params) -->
+
<!-- GIDEROSMTD:r3d.World:testAABBOverlap(bodyA,bodyB) checks if two bodies AABB overlap -->
[[Special:MyLanguage/r3d.World:createFixedJoint|r3d.World:createFixedJoint]] <br/><!-- GIDEROSMTD:r3d.World:createFixedJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,params) -->
+
[[Special:MyLanguage/r3d.World:testCollision|r3d.World:testCollision]] ''<translate>checks collisions</translate>''<br/>
[[Special:MyLanguage/r3d.World:destroyJoint|r3d.World:destroyJoint]] ''<translate>destroy a joint</translate>''<br/><!-- GIDEROSMTD:r3d.World:destroyBody(joint) destroy a joint -->
+
<!-- GIDEROSMTD:r3d.World:testCollision([bodyA,[bodyB,]]callback[,category]) checks collisions -->
 +
[[Special:MyLanguage/r3d.World:testOverlap|r3d.World:testOverlap]] ''<translate>checks if two bodies overlap</translate>''<br/>
 +
<!-- GIDEROSMTD:r3d.World:testOverlap(bodyA,bodyB) checks if two bodies overlap -->
 +
[[Special:MyLanguage/r3d.World:setEventListener|r3d.World:setEventListener]] ''<translate>sets the event listener for collisions in the world</translate>''<br/>
 +
<!-- GIDEROSMTD:r3d.World:setEventListener(listener) sets the event listener for collisions in the world -->
 +
[[r3d.World:createBallAndSocketJoint]] ''creates a ball and socket joint''<br/>
 +
<!-- GIDEROSMTD:r3d.World:createBallAndSocketJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,params) creates a ball and socket joint -->
 +
[[r3d.World:createHingeJoint]] ''creates a hinge joint''<br/>
 +
<!-- GIDEROSMTD:r3d.World:createHingeJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,axisX,axisY,axisZ,params) creates a hinge joint -->
 +
[[r3d.World:createSliderJoint]] ''creates a slider joint''<br/>
 +
<!-- GIDEROSMTD:r3d.World:createSliderJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,axisX,axisY,axisZ,params) creates a slider joint -->
 +
[[r3d.World:createFixedJoint]] ''creates a fixed joint'' <br/>
 +
<!-- GIDEROSMTD:r3d.World:createFixedJoint(bodyA,bodyB,anchorX,anchorY,anchorZ,params) creates a fixed joint -->
 +
[[r3d.World:destroyJoint]] ''destroys a joint''<br/>
 +
<!-- GIDEROSMTD:r3d.World:destroyBody(joint) destroys a joint -->
 +
 
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 +
 
|}
 
|}
 +
 +
----
 +
'''[[ReactPhysics3D]]'''

Revision as of 07:59, 8 January 2021


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

Description

A dynamics world is used to automatically simulate the motion of your bodies using the world physics.

Bodies will be automatically moved using collisions, joints and forces. You do not have to move the bodies manually (but you still can if needed).

The dynamics world will contain the bodies and joints that you create. You will then be able to run your simulation across time by updating the world at each frame.

The DynamicsWorld class (which inherits from the CollisionWorld class) represents a dynamics world in the ReactPhysics3D library.

Methods

r3d.World.new creates a new world
r3d.World:createBody creates a new body
r3d.World:destroyBody destroys a body
r3d.World:step steps the world
r3d.World:raycast performs a ray cast on the world
r3d.World:testAABBOverlap checks if two bodies AABB overlap
r3d.World:testCollision checks collisions
r3d.World:testOverlap checks if two bodies overlap
r3d.World:setEventListener sets the event listener for collisions in the world
r3d.World:createBallAndSocketJoint creates a ball and socket joint
r3d.World:createHingeJoint creates a hinge joint
r3d.World:createSliderJoint creates a slider joint
r3d.World:createFixedJoint creates a fixed joint
r3d.World:destroyJoint destroys a joint


ReactPhysics3D