PhysicsCreateShape

From Multi Theft Auto: Wiki
Revision as of 09:12, 9 February 2020 by CrosRoad95 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} Creates physics shape used for static or dynamic collision detection ==Syntax== <syntaxhighlight lang="lua"> physics-shape physicsCreateShape(...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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, vector3, vector3, ...)
physics-shape physicsCreateShape(physics thePhysics, "convexhull", TODO)
  • 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.

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