PhysicsCreateShape: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} Creates physics shape used for static or dynamic collision detection ==Syntax== <syntaxhighlight lang="lua"> physics-shape physicsCreateShape(...")
 
No edit summary
Line 15: Line 15:
physics-shape physicsCreateShape(physics thePhysics, "heightfieldterrain", int sizeX, int sizeY [, float height,float height, ... )
physics-shape physicsCreateShape(physics thePhysics, "heightfieldterrain", int sizeX, int sizeY [, float height,float height, ... )
physics-shape physicsCreateShape(physics thePhysics, "compound", int initialChildCapacity = 0)
physics-shape physicsCreateShape(physics thePhysics, "compound", int initialChildCapacity = 0)
physics-shape physicsCreateShape(physics thePhysics, "trianglemesh", vector3, vector3, vector3, ...)
physics-shape physicsCreateShape(physics thePhysics, "trianglemesh", vector3 vertexA, vector3 vertexB, vector3 vertexC, ...)
physics-shape physicsCreateShape(physics thePhysics, "convexhull", TODO)
physics-shape physicsCreateShape(physics thePhysics, "convexhull", vector3 pointA, vector3 pointB, vector3, pointC, ...)
</syntaxhighlight>
</syntaxhighlight>


Line 22: Line 22:
*'''trianglemesh:''' each of three vectors creates single triangle, use n*3 vectors to create n triangles.
*'''trianglemesh:''' each of three vectors creates single triangle, use n*3 vectors to create n triangles.
*'''compound:''' can contain up to 8192 child shapes.
*'''compound:''' can contain up to 8192 child shapes.
*'''convexhull:''' require at least 3 points.


===Required Arguments===  
===Required Arguments===  

Revision as of 20:41, 18 February 2020

Creates physics shape used for static or dynamic collision detection

Syntax

physics-shape physicsCreateShape(physics thePhysics, shape-type theShapeType, mixed)
         
physics-shape physicsCreateShape(physics thePhysics, "box", float size)
physics-shape physicsCreateShape(physics thePhysics, "box", float sizeX, sizeY, sizeZ)
physics-shape physicsCreateShape(physics thePhysics, "sphere", float radius)
physics-shape physicsCreateShape(physics thePhysics, "capsule", float radius, float height)
physics-shape physicsCreateShape(physics thePhysics, "cone", float radius, float height)
physics-shape physicsCreateShape(physics thePhysics, "cylinder", float radius, float height)
physics-shape physicsCreateShape(physics thePhysics, "heightfieldterrain", int sizeX, int sizeY [, float height,float height, ... )
physics-shape physicsCreateShape(physics thePhysics, "compound", int initialChildCapacity = 0)
physics-shape physicsCreateShape(physics thePhysics, "trianglemesh", vector3 vertexA, vector3 vertexB, vector3 vertexC, ...)
physics-shape physicsCreateShape(physics thePhysics, "convexhull", vector3 pointA, vector3 pointB, vector3, pointC, ...)
  • heightfieldterrain: minimum size is 3x3, and maximum 8192x8192. By default terrain is flat, you can pass default height after size, each float represents height of next vertex.
  • trianglemesh: each of three vectors creates single triangle, use n*3 vectors to create n triangles.
  • compound: can contain up to 8192 child shapes.
  • convexhull: require at least 3 points.

Required Arguments

  • thePhysics: physics world
  • theShapeType: shape, availiable types "box", "sphere", "capsule", "cone", "cylinder", "heightfieldterrain", "compound", "trianglemesh", "convexhull",

Returns

  • physics-shape to use in future functions

Example


See Also