EntityPhysicBody()

Syntax

EntityPhysicBody(#Entity, Type [, Mass [, Restitution, Friction]])
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_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.
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()

Supported OS

All

<- EntityParentNode() - Entity Index - EntityPitch() ->