SpriteAnimation.lua
Tile.lua
Neo3D.lua
QuadTree.lua
Widget.lua
Sprite.lua
Collision.lua
OEntity.lua
Button.lua
Graphics2D.lua
InputField.lua
LuaUnit.lua
Tests.lua
OCamera.lua
Object3d.lua
class.lua
OLight.lua
SpriteSheet.lua
OSound.lua
Utils.lua
Canvas.lua
Label.lua
Api.lua

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

The ID of the new animation.

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

The new animation 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

The index of the new frame.

function OEntity:enableShadow(enabled)

Enables/Disables the shadow for this object.

Parameter

enabled

A boolean value

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

The value as a number

function OEntity:getAngularDamping()

Returns the angular damping

Return: The angular damping as a number.

function OEntity:setAngularDamping(damping)

Changes the angular damping

Parameter

damping

the value as a number

function OEntity:getAngularFactor()

Returns the angular factor

Return: The angular factor as a number.

function OEntity:setAngularFactor(factor)

Changes the angular factor

Parameter

factor

The new factor as a number

function OEntity:getLinearFactor()

Returns the linear factor

Return: The linear factor as a vec3

function OEntity:setLinearFactor(factor)

Changes the linear factor

Parameter

factor

The linear factor as a vec3

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

The new mass as a number

function OEntity:setFriction(fric)

Changes the friction of the entity

Parameter

fric

The friction as a number.

function OEntity:getFriction()

Returns the friction value

Return: The friction value as a number.

function OEntity:setRestitution(rest)

Changes the restitution value

Parameter

rest

The new restitution value as a number

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

A vec3 containing the force to apply.

mode

A string containing "local". Can be left out.

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

A vec3 containing the torque to apply.

mode

A string containing "local". Can be left out.

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

An OEntity object

Return: A boolean

function OEntity:getNumCollisions()

Returns the number of collisions the object currently has.

Return: The number of collisions as a number.