PhysicsCreateShape

From Multi Theft Auto: Wiki
Revision as of 20:41, 18 February 2020 by CrosRoad95 (talk | contribs)
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 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