PhysicsCreateShapeFromModel: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| CrosRoad95 (talk | contribs)  (Created page with "__NOTOC__  {{Client function}} Creates shape from model in specific physics world. Model must be streamed in ( orignal gtasa models counts as stream in ) ==Syntax==  <syntaxhi...") | CrosRoad95 (talk | contribs)  | ||
| Line 18: | Line 18: | ||
| Spawns hay, tree, barn, hay stack and fence as rigid body near by 0,0,0 coords | Spawns hay, tree, barn, hay stack and fence as rigid body near by 0,0,0 coords | ||
| <syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
| function createRigidBodyFromModel(model, x, y, z) | |||
|    local shape = physicsCreateShapeFromModel(physics, model) |    local shape = physicsCreateShapeFromModel(physics, model) | ||
|    if(shape)then |    if(shape)then | ||
|      local rigid = physicsCreateRigidBody( |      local rigid = physicsCreateRigidBody(shape) | ||
|      physicsSetProperties(rigid, "position",  x, y, z) |      physicsSetProperties(rigid, "position",  x, y, z) | ||
|    end |    end | ||
Latest revision as of 14:34, 19 February 2020
Creates shape from model in specific physics world. Model must be streamed in ( orignal gtasa models counts as stream in )
Syntax
physics-shape physicsCreateShapeFromModel(physics thePhysics, int model)
Required Arguments
- thePhysics: Physics world.
- model: object model.
Returns
- shape compound shape made of triangle mesh, boxes and spheres.
Example
Spawns hay, tree, barn, hay stack and fence as rigid body near by 0,0,0 coords
function createRigidBodyFromModel(model, x, y, z)
  local shape = physicsCreateShapeFromModel(physics, model)
  if(shape)then
    local rigid = physicsCreateRigidBody(shape)
    physicsSetProperties(rigid, "position",  x, y, z)
  end
end
createRigidBodyFromModel(3276, 0,0,10)
createRigidBodyFromModel(672, 20,0,10)
createRigidBodyFromModel(12918, -20,0,10)
createRigidBodyFromModel(3374, 0,20,10)
createRigidBodyFromModel(12919, 0,-30,10)
See Also
- physicsCreateWorld
- physicsDestroy
- physicsCreateShape
- physicsCreateShapeFromModel
- physicsCreateRigidBody
- physicsCreateStaticCollision
- physicsCreateConstraint
- physicsAddChildShape
- physicsRemoveChildShape
- physicsGetChildShapes
- physicsSetChildShapeOffsets
- physicsGetChildShapeOffsets
- physicsGetShapes
- physicsGetRigidBodies
- physicsGetStaticCollisions
- physicsGetConstraints
- physicsSetProperties
- physicsGetProperties
- physicsDrawDebug
- physicsSetDebugMode
- physicsBuildCollisionFromGTA
- physicsApplyVelocity
- physicsApplyVelocityForce
- physicsApplyAngularVelocity
- physicsApplyAngularVelocityForce
- physicsApplyDamping
- physicsRayCast
- physicsShapeCast
- physicsGetElementType
- physicsIsElement