The OEntity class
An 'OEntity' instance is an entity object in a scene which can be
manipulated. The 'OEntity' class is mostly used to manage meshes in your 3D scene.
See also: Widget
OEntity(object3d)
Create a new OEntity object with the given Object3d
as the base. Will return 'nil' if the given object is not of type 'Entity'.
If you give a path as the base object it will load the new mesh and add it to the current scene.
function OEntity:getPath()
Returns the path to the loaded mesh file.
Return: The path as a string.
function OEntity:getCurrentAnimation()
Returns the ID of the currently running animation.
Return: The ID as a number
function OEntity:changeAnimation(id)
Changes the current animation and starts the new one.
Parameter
id
function OEntity:isAnimationOver()
Checks if the currently running animation has finished.
Return: A boolean
function OEntity:getAnimationSpeed()
Returns the current animation speed.
Return: The animation speed as a number.
function OEntity:setAnimationSpeed(speed)
Changes the animation speed.
Parameter
speed
function OEntity:getCurrentFrame()
Returns the current frame of the animation that is being
displayed.
Return: The current frame number
function OEntity:setCurrentFrame(frame)
Changes the current frame that is being displayed.
Parameter
frame
function OEntity:enableShadow(enabled)
Enables/Disables the shadow for this object.
Parameter
enabled
function OEntity:hasShadow()
Checks if the entity has a shadow.
Return: A boolean value
function OEntity:getLinearDamping()
Returns the linear damping value
Return: The linear damping as a number
function OEntity:setLinearDamping(damping)
Changes the linear damping value
Parameter
damping
function OEntity:getAngularDamping()
Returns the angular damping
Return: The angular damping as a number.
function OEntity:setAngularDamping(damping)
Changes the angular damping
Parameter
damping
function OEntity:getAngularFactor()
Returns the angular factor
Return: The angular factor as a number.
function OEntity:setAngularFactor(factor)
Changes the angular factor
Parameter
factor
function OEntity:getLinearFactor()
Returns the linear factor
Return: The linear factor as a vec3
function OEntity:setLinearFactor(factor)
Changes the linear factor
Parameter
factor
function OEntity:getMass()
Returns the mass of the entity
Return: The mass as a number
function OEntity:setMass(mass)
Changes the mass of the entity
Parameter
mass
function OEntity:setFriction(fric)
Changes the friction of the entity
Parameter
fric
function OEntity:getFriction()
Returns the friction value
Return: The friction value as a number.
function OEntity:setRestitution(rest)
Changes the restitution value
Parameter
rest
function OEntity:getRestitution()
Returns the restitution value
Return: The restitution value as a number.
function OEntity:clearForces()
Clears the central force
function OEntity:addCentralForce(force, mode)
Applies a new central force to the given object.
The new force will be added to the currently existing central force of the
object. The mode parameter is optional and allows you to apply forces relative to the objects
current rotation.
Parameter
force
mode
function OEntity:addTorque(torque, mode)
Applies a new torque to the given object.
The new torque will be added to the currently existing torque of the
object. The mode parameter is optional and allows you to apply a torque relative to the objects
current rotation.
Parameter
torque
mode
function OEntity:getCentralForce()
Returns the central force
Return: The central force as a vec3
function OEntity:getTorque()
Returns the current torque
Return: The torque as a vec3
function OEntity:isColliding()
Checks if the object is colliding with anything.
Return: A boolean value
function OEntity:isCollidingWith(object)
Checks if the object is colliding with the given object.
Parameter
object
Return: A boolean
function OEntity:getNumCollisions()
Returns the number of collisions the object currently has.
Return: The number of collisions as a number.