AddSubEntity()
Syntax
Result = AddSubEntity(#Entity, #SubEntity, Type, [OffsetX, OffsetY, OffsetZ [, SizeX, SizeY, SizeZ [, AxisX, AxisY, AxisZ]]])Description
Add a sub entity to an entity.
Parameters
#Entity The entity to use. #SubEntity The entity to add. Type Type defines how the physic engine will handle this entity. It can be one of the following constants: #PB_Entity_StaticBody : The body is a static only, which means the mesh can't be animated. This mode allows very precise collisions, as it's done against triangles (also known as tri-mesh collision). It's also fast when colliding with a box or sphere entity body type. It's perfect when using a mesh for a ground or static world. #PB_Entity_PlaneBody : A 'virtual' plane is set on the entity (with the same dimensions) and is used to manage the collision against the other entities. #PB_Entity_ConeBody : A 'virtual' cone is set around the entity (with the same dimensions) and is used to manage the collision against the other entities. #PB_Entity_BoxBody : A 'virtual' box is set around the entity (with the same dimensions) and is used to manage the collision against the other entities. #PB_Entity_SphereBody : A 'virtual' sphere is set around the entity and is used to manage the collision against the other entities. #PB_Entity_CylinderBody : A 'virtual' cylinder is set around the entity and is used to manage the collision against the other entities. #PB_Entity_CapsuleBody : A 'virtual' capsule is set around the entity and is used to manage the collision against the other entities. #PB_Entity_ConvexHullBody : A 'virtual' complex form deduced from the real mesh is set around the entity and is used to manage the collision against the other entities. This mode is slower than basic collide forms. #PB_Entity_CompoundBody : A 'virtual' Compound body is set around the entity and this is the fastest kind of arbitrary shape. It is defined by a cloud of vertices but the shape formed is the smallest convex shape that encloses the vertices.OffsetX, OffsetY, OffsetZ (optional) Offset of the translation of the body. SizeX, SizeY, SizeZ (optional) The bounding box size of the body. It only applies to the following body type: #PB_Entity_BoxBody : SizeX, SizeY and SizeZ are available. #PB_Entity_SphereBody : SizeX is available. #PB_Entity_ConeBody : SizeX and SizeY are available. #PB_Entity_CylinderBody: SizeX and SizeY are available. #PB_Entity_CapsuleBody : SizeX, SizeY and SizeZ are available.If SizeX = -1 then it uses the BoundingBox.AxisX, AxisY, AxisZ (optional) The axis of the body' orientation. It only applies to the following body type: #PB_Entity_PlaneBody #PB_Entity_CylinderBody #PB_Entity_CapsuleBody
Return value
Returns zero if the entity can't be created.
Remarks
It is necessary to use the CreateEntityBody() function with the #PB_Entity_CompoundBody option after adding all sub-entities.
See Also
CreateEntity()
Supported OS
All