CreateEntityBody()

Syntax

CreateEntityBody(#Entity, Type [, Mass [, Restitution, Friction [, SizeX, SizeY, SizeZ [, AxisX, AxisY, AxisZ]])
Description
Changes the type of the body associated with the #Entity.

To have its collisions managed by the physic engine, an entity has to set a body. In fact, only the body is known by the physic engine, which will do all the calculation about the entity, check the mass, friction and if it collides will move back the real entity.

To have any effect, the physic engine needs to be activated with the EnableWorldPhysics().

Parameters

Type Type defines how the physic engine will handle this entity. It can be one of the following constants:
  #PB_Entity_None       : No body is associated to the entity (default)
  #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 is used to manage the collision
                          against the other entities.
Mass (optional) Mass of the object. Don't use too big value or it could produce physic incoherencies (1 is the preferred value).
Restitution (optional) Restitution of the object. This value can also be get or set via GetEntityAttribute() and SetEntityAttribute()
Friction (optional) Friction of the object. This value can also be get or set via GetEntityAttribute() and SetEntityAttribute()
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.
AxisX, AxisY, AxisZ (optional) The axis of the body. It only applies to the following body type:
  #PB_Entity_PlaneBody
  #PB_Entity_CylinderBody
  #PB_Entity_CapsuleBody 

Return value

None.

See Also

FreeEntityBody()

Supported OS

All

<- CreateEntity() - Entity Index - DetachEntityObject() ->