EEVENT_TYPE
|
EKEY_ACTION
|
EKEY_CODE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ELOG_LEVEL
|
EMOUSE_INPUT_EVENT
|
Function | Description |
createDevice(type, size, bits, fullscreen, stencilbuffer, vsync, receiver) | Returns an IrrlichtDevice object. |
createDeviceEx(parameters) | Returns an IrrlichtDevice object. |
-- create a new Irrlicht device
local device = irr.createDevice(irr.video.EDT_SOFTWARE, irr.core.dimension2d(640, 480), 16, false, false, false, receiver)
...
-- create a new device with default parameters (see the irrlicht documentation for what the default parameters are)
local device = irr.createDevice()
...
-- create a new device using createDeviceEx()
local param = irr.SIrrlichtCreationParameters()
param.DriverType = irr.video.EDT_OPENGL
param.WindowSize = irr.core.dimension2d(200,200)
local device = irr.createDeviceEx(param)
Method | Description |
ILogger:getLogLevel() | gets the log level |
ILogger:setLogLevel(level) | sets the log level |
ILogger:log(text, level) | output text to the log |
-- set the log level
device:getLogger():setLogLevel(irr.ELL_WARNING)
-- report some status
device:getLogger():log("WARNING: Vertex shaders disabled because of missing driver/hardware support.")
Method | Description |
IrrlichtDevice:run() | runs the device |
IrrlichtDevice:getVideoDriver() | returns the IVideoDriver object |
IrrlichtDevice:getFileSystem() | returns the IFileSystem object |
IrrlichtDevice:getGUIEnvironment() | returns the IGUIEnvironment object |
IrrlichtDevice:getSceneManager() | returns the ISceneManager object |
IrrlichtDevice:getCursorControl() | returns the ICursorControl object |
IrrlichtDevice:getLogger() | returns the ILogger object |
IrrlichtDevice:getVideoModeList() | returns the IVideoModeList object |
IrrlichtDevice:getOSOperator() | returns the IOSOperator object |
IrrlichtDevice:getTimer() | returns the ITimer object |
IrrlichtDevice:setWindowCaption(caption) | Sets the window caption text to 'caption' |
IrrlichtDevice:isWindowActive() | returns if the current window is 'active' |
IrrlichtDevice:closeDevice() | closes the device, makes run() return false when called |
IrrlichtDevice:getEventReceiver() | gets the current EventReceiver |
IrrlichtDevice:setEventReceiver(Receiver) | sets the current EventReceiver |
IrrlichtDevice:getVersion() | returns the Irrlicht version as a string, e.g. "1.2.3" |
IrrlichtDevice:setResizAble(resize) | sets the boolean resizable property |
local driver = device:getVideoDriver()
local smgr = device:getSceneManager()
while device:run() do
driver:beginScene(true, true, irr.video.SColor(0,200,200,200))
smgr:drawAll()
driver:endScene()
end
device:drop()
Method | Description |
ITimer:getRealTime() | gets the current real time |
ITimer:getTime() | gets the current time |
ITimer:setTime(time) | sets the virtual time |
ITimer:stop() | stops the virtual timer |
ITimer:start() | starts the virtual timer |
ITimer:setSpeed(speed) | sets the speed of the timer |
ITimer:getSpeed() | returns the speed of the timer |
ITimer:isStopped() | returns true if the timer is stopped |
ITimer:tick() | causes the timer to tick, normally called by run() |
-- get the time
local time = device:getTimer():getTime()
-- set the time
device:getTimer():setTime(42)
Method | Description |
IUnknown:grab() | grabs the object, increasing the reference count |
IUnknown:drop() | drops the object, decreasing the reference count and deleting if necessary |
IUnknown:getDebugName() | returns the debug name of the object as a string. |
-- drop the device when finished (derived from IUnknown)
device:drop()
EIntersectionRelation3D
|
Method | Description |
aabbox3d() | Creates an axis aligned bounding box with coordinates -1,-1,-1, 1,1,1. |
aabbox3d(minEdge, maxEdge) | Creates an axis aligned bounding box with coordinates of minEdge(vector3d) and maxEdge (vector3d) |
aabbox3d(init) | Creates an axis aligned bounding box with coordinates of init(vector3d) and init (vector3d) |
aabbox3d(minx, miny, minz, maxx, maxy, maxz) | Creates an axis aligned bounding box. |
| |
operator == | boolean comparison operator of aabbox3d. |
| |
addInternalPoint(point) | Adds a point (vector3d) to the bounding box, causing it to grow larger. |
addInternalPoint(X,Y,Z) | Adds a point to the bounding box, causing it to grow larger. |
addInternalBox(box) | Adds another box (aabbox3d) to the bounding box, causing it to grow larger. |
reset(X,Y,Z) | Resets the bounding box. |
reset(initValue) | Resets the bounding box to initValue(aabbox3d). |
reset(initValue) | Resets the bounding box to initValue(vector3d). |
isPointInside(point) | Returns true if the point (vector3d) is inside the bounding box. |
isPointTotalInside(point) | Returns true if the point total (vector3d) is inside the bounding box. |
intersectsWithBox(box) | Returns true if the bounding box intersects with the other box (aabbox3d) |
intersectsWithLine(line) | Returns true if the bounding box intersects with the line (line3d). |
intersectsWithLine(linemiddle, linevect, halflength) | Returns true if the bounding box intersects with the line (vector3d, vector3d, number). |
classifyPlaneRelation(plane) | Returns the plane relation of the bounding box (plane3d). |
getCenter() | Returns the center of the bounding box as a vector3d. |
getExtent() | Returns the extent of the bounding box as a vector3d. |
getEdges() | Returns the edges of the bounding box as a table of eight variables of type vector3d. |
isEmpty() | Returns true if the box is empty (has a volume of zero) |
repair() | Repairs the aabbox3d, if for example MinEdge and MaxEdge are swapped. |
getInterpolated() | Calculates a new interpolated bounding box (aabbox3d) |
| |
MinEdge | Member variable (vector3d) |
MaxEdge | Member variable (vector3d) |
local box = irr.core.aabbox3d() -- creates a bounding box
local v1 = box:getCenter()
local edges = box:getEdges()
for i,edge in pairs(edges) do
print("Edge ", i, " == (",edge.X, ",", edge.Y, ",", edge.Z,")")
end
box:reset(0,0,0)
Notes:
Internally aabbox3d has a type of 'f32'.
Method | Description |
array(T) | Creates a zero based array based on the table T. The types of variables contained in T must be one of: number, vector3d, ITexture |
| |
operator [] | index operator (zero based) |
| |
reallocate(new_size) | reallocates the array, making it bigger or smaller. |
push_back(element) | Adds an element at back of the array. |
push_front(element) | Adds an element at front of the array. |
insert(element, index) | Inserts an element at index 'index' of the array. (zero based) |
clear() | clears and deletes all allocated memory |
set_pointer(newPointer, size) | Sets pointer to new array, using this as new workspace. |
set_free_when_destroyed(f) | Sets if the array should delete the memory when the array is destroyed (bool) |
set_used(usedNow) | Sets the size of the array. |
getLast() | Returns the last element |
pointer() | returns a pointer to the array |
const_pointer() | returns a const pointer to the array |
size() | returns the size of used array |
allocated_size() | returns the total memory allocated for the array |
empty() | returns true if the array is empty |
erase(index) | Erases an element from the array (zero based) |
erase(index, count) | Erases some elements from the array (zero based) |
local vectors =
{
irr.core.vector3d(1,2,3),
irr.core.vector3d(4,5,6),
irr.core.vector3d(7,8,9)
}
local array = irr.core.array( vectors ) -- creates an irr.core.array variable of vector3d's
local v1 = array[0] -- access array element #1
local v2 = array[1]
print( v1.X, v2.X, array[2].X )
array:push_back(irr.core.vector3d(10,11,12))
print( array[3].X )
Method | Description |
dimension2d() | Creates a dimension2d object with 0,0 dimensions. |
dimension2d(Width, Height) | Creates a dimension2d object with Width,Height dimensions. |
dimension2d(other) | Creates a dimension2d object from the other object's dimensions. |
| |
operator == | boolean comparison operator of dimension2d. |
| |
Width | Member variable (number) |
Height | Member variable (number) |
local dims = irr.core.dimension2d() -- creates a dimension variable
local w,h = dims.Width, dims.Height
local dims2 = irr.core.dimension2d(w, h)
if dims == dims2 then
print("dims are equal")
end
Notes:
Internally dimension2d has a type of 'f32'. As 'f32' is the most common dimension2d type used, all IrrLua functions assume
dimension2d has type of 'f32'. The few Irrlicht methods that would normally take type 's32' dimensions are converted internally by the
wrappers to the correct type.
irr.core.dimension2ds32() is also available and may be needed when creating your own binary modules.
Method | Description |
line3d() | Creates a line3d object with length of 1. |
line3d(Start, End) | Creates a line3d object between start and end (vector3d, vector3d) |
| |
operator + | Adds two lines |
operator - | Subtracts two lines |
operator == | boolean comparison operator of line3d. |
| |
setLine(xa,ya,za, xb,yb,zb) | |
setLine(start, end) | (vector3d, vector3d) |
setLine(otherLine) | (line3d) |
getLength() | returns the length. |
getLengthSQ() | returns the square of the length. Useful if you want/can avoid a sqrt(). |
getMiddle() | returns the middle point. (vector3d) |
getClosestPoint(point) | returns the closest point to 'point' (vector3d) |
getIntersectionWithSphere(sorigin, sradius) | returns two values: boolean, Number. If intesection is true, number represents the distance to the first intersection point. |
| |
start | Member variable (vector3d) |
end | Member variable (vector3d) |
local line = irr.core.line3d() -- creates a line3d variable
local middle = line:getMiddle()
print(middle.X, middle.Y, middle.Z)
local line2 = irr.core.line3d(line.start, line:getMiddle())
print(line2.start.X, line2.start.Y, line2.start.Z)
print(line2["end"].X, line2["end"].Y, line2["end"].Z) -- cannot use 'line2.end.X' because 'end' is a reserved word
Notes:
Line3d has a member called 'end'. This is unfortunate as 'end' is a reserved word in Lua. To get around this issue, you
can use the bracket notation as shown in the code above.
Method | Description |
matrix4() | Creates a matrix4 object. |
| |
operator == | boolean comparison operator |
operator * | multiply two matrixes |
| |
makeIdentity() | Sets the matrix to the identity matrix. |
isIdentity() | returns true if the matrix is the identity matrix. |
setTranslation(translation) | Sets the translation members of the matrix (vector3d) |
getTranslation() | Gets the translation of the matrix (vector3d) |
setInverseTranslation(translation) | Sets the inverse translation the matrix (vector3d) |
setRotationRadians(rotation) | Make a rotation matrix from Euler angles (vector3d) |
setRotationDegrees(rotation) | Make a rotation matrix from Euler angles (vector3d) |
setInverseRotationRadians(rotation) | Make an inverted rotation matrix from Euler angles (vector3d) |
setInverseRotationDegrees(rotation) | Make an inverted rotation matrix from Euler angles (vector3d) |
setScale(scale) | Sets the scale (vector3d) |
inverseTranslateVect(vect) | Translate a vector by the inverse of the translation part of this matrix. (vector3d) |
inverseRotationVect(vect) | Rotate a vector by the inverse of the rotation part of this matrix. (vector3d) |
rotateVect(vect) | Rotate a vector by the rotation part of this matrix. (vector3d) |
transformVect(vect) | Transform a vector by this matrix. (vector3d) |
transformVect(invector, outvector) | Transform a vector by this matrix, store result in outvector. (vector3d, vector3d) |
translateVect(vect) | Translate a vector by the translation part of this matrix. (vector3d) |
transformPlane(plane) | Transform a plane by this matrix (plane3d) |
transformBox(box) | Transform a box by this matrix (aabbox3d) |
transformBoxEx(box) | Transform a box by this matrix, slower but more accurately (aabbox3d) |
multiplyWith1x4Matrix(array) | Perform a 1x4 multiply ('array' currently unsupported in IrrLua) |
makeInverse() | Inverts the matrix, if possible. Returns true if successful |
getInverse(outMatrix) | Creates an inverse matrix, store result in out. Returns true if inverse matrix exists |
buildProjectionMatrixPerspectiveFovRH(fieldOfViewRadians, aspectRatio, zNear, zFar) | Builds a right-handed perspective projection matrix based on a field of view (number, number, number, number) |
buildProjectionMatrixPerspectiveFovLH(fieldOfViewRadians, aspectRatio, zNear, zFar) | Builds a left-handed perspective projection matrix based on a field of view (number, number, number, number) |
buildProjectionMatrixPerspectiveRH(widthOfViewVolume, heightOfViewVolume, zNear, zFar) | Builds a right-handed perspective projection matrix. (number, number, number, number) |
buildProjectionMatrixPerspectiveLH(widthOfViewVolume, heightOfViewVolume, zNear, zFar) | Builds a left-handed perspective projection matrix. (number, number, number, number) |
buildProjectionMatrixOrthoLH(widthOfViewVolume, heightOfViewVolume, zNear, zFar) | Builds a left-handed orthogonal projection matrix.(number, number, number, number) |
buildProjectionMatrixOrthoRH(widthOfViewVolume, heightOfViewVolume, zNear, zFar) | Builds a right-handed orthogonal projection matrix. (number, number, number, number) |
buildCameraLookAtMatrixLH(position, target, upVector) | Builds a left-handed look-at matrix. (vector3d, vector3d, vector3d) |
buildCameraLookAtMatrixRH(position, target, upVector) | Builds a right-handed look-at matrix. (vector3d, vector3d, vector3d) |
buildShadowMatrix(light, plane, point) | Builds a matrix that flattens geometry into a plane. (vector3d, plane3d, number) |
buildNDCToDCMatrix(area, zScale) | Builds a matrix which transforms a normalized Device Coordinate to Device Coordinates. (rect, number) |
interpolate(b,time) | creates a new matrix as interpolated matrix from two other ones. (matrix4, number) |
getTransposed() | returns the transposed matrix |
| |
M[16] | Member variable (table of 16 numbers, starting at index 1) |
local matrix = irr.core.matrix4() -- creates a line3d variable
local inv = irr.core.matrix4()
matrix:getInverse(inv)
matrix:setScale(irr.core.vector3d(2,2,2))
Method | Description |
plane3d() | Creates a plane3d object. |
plane3d(px,py,pz,nx,ny,nz) | Creates a plane3d object (number, number, number, number, number, number). |
plane3d(other) | Creates a plane3d object. (plane3d) |
plane3d(point1, point2, point3) | Creates a plane3d object. (vector3d, vector3d, vector3d) |
| |
operator == | boolean comparison operator |
| |
setPlane(point, nvector) | (vector3d, vector3d) |
setPlane(nvect, d) | (vector3d, number) |
setPlane(pont, point, point) | (vector3d, vector3d, vector3d) |
getIntersectionWithLine( linePoint, lineVect, outIntersection) | Returns an intersection with a 3d line. (vector3d, vector3d, vector3d) |
getKnownIntersectionWithLine( linePoint1, linePoint2) | Returns where on a line between two points an intersection with this plane happened. (vector3d, vector3d) |
getIntersectionWithLimitedLine( linePoint1, linePoint2, outIntersection) | Returns an intersection with a 3d line, limited between two 3d points. (vector3d, vector3d, vector3d) |
classifyPointRelation( point) | Classifies the relation of a point to this plane (vector3d) |
recalculateD( MPoint) | Recalculates the distance from origin by applyinga new member point to the plane. (vector3d) |
getMemberPoint() | Returns a member point of the plane (vector3d) |
existsInterSection(other) | Tests if there is a intersection between this plane and another. Returns bool (plane3d) |
getIntersectionWithPlane( other, outLinePoint, outLineVect) | Intersects this plane with another. returns bool (plane3d, vector3d, vector3d) |
getIntersectionWithPlanes( plane1, plane2, outPoint) | Returns the intersection point with two other planes if there is one. (plane3d, plane3d, vector3d) |
isFrontFacing( lookDirection) | Returns if the plane is front of backfacing. Note that this only works if the normal is Normalized. returns bool (vector3d) |
getDistanceTo(point) | Returns the distance to a point. Note that this only works if the normal is Normalized. (rector3d) |
| |
Normal | Member variable (vector3d) |
D | Member variable (distance from origin) (number) |
local plane = irr.core.plane3d()
local p2 = irr.core.plane3d(irr.core.vector3d(1,1,1), irr.core.vector3d(0,0,0), irr.core.vector3d(2,2,2))
local p3 = irr.core.plane3d(1,2,3,4,5,6)
local line = irr.core.line3d()
local intersection = irr.core.vector3d()
p3:getIntersectionWithline(line.begin, line["end] - line.begin, intersection)
Notes: Internally plane3d has a type of 'f32'.
Method | Description |
position2d() | Creates a position2d object at 0,0. |
position2d(X, Y) | Creates a position2d object at X,Y. |
position2d(other) | Creates a position2d object from other (position2d). |
| |
operator == | boolean comparison operator |
operator + | add two positions |
operator - | subtract two positions |
| |
X | Member variable (number) |
Y | Member variable (number) |
local pos1 = irr.core.position2d(1,2) -- creates a position variable
local pos2 = irr.core.position2d(3,4) -- creates a position variable
local newPos = pos1 + pos2
print(newPos.X, newPos.Y)
Notes:
Internally position2d has a type of 's32'. As 's32' is the most common position2d type used, all IrrLua functions assume
position2d has type of 's32'. The few Irrlicht methods that would normally take type 'f32' dimensions are converted internally by the
wrappers to the correct type.Method | Description |
quaternion() | Creates a quaternion object |
quaternion(X,Y,Z,W) | Creates a quaternion object |
quaternion(x,y,z) | Creates a quaternion object, converting euler angles |
quaternion(mat) | Creates a quaternion object from a matrix4 (matrix4) |
| |
operator == | boolean comparison operator |
operator + | add two quaternions |
operator - | subtract two quaternions |
operator * | multiply two quaternions |
operator * | multiply quaternion by a number |
| |
getDotProduct(other) | calculates the dot product (quaternion) |
set(X,Y,Z,W) | set the quaternion object |
set(x,y,z) | set the quaternion object, converting euler angles |
normalize() | normalizes the quaternion |
getMatrix() | creates a matrix4 from this quaternion |
makeInverse() | inverts the quaternion |
slerp(q1, q2, time) | Interpolates the quaternion between two quaternions based on time (quaternion, quaternion, number) |
fromAngleAxis(angle, axis) | (number, vector3d) |
toEuler(angle) | (vector3d) |
| |
X | Member variable (number) |
Y | Member variable (number) |
Z | Member variable (number) |
W | Member variable (number) |
local q1 = irr.core.quaternion() -- creates a quaternion variable
local q2 = irr.core.quaternion(1,2,3,4) -- creates a quaternion variable
local q3 = q1 + q2
print(q3.X, q3.Y, q3.Z, q3.W)
q3:normalize()
Method | Description |
rect() | Creates a rect object |
rect(x1,y1,x2,y2) | Creates a rect object |
rect(pos1,pos2) | Creates a rect object (position2d, positon2d) |
rect(other) | Creates a rect object (rect) |
rect(pos, dimension) | Creates a rect object (position2d, dimension2d) |
| |
operator == | boolean comparision operator |
operator + | add a position to a rect, moving it |
| |
isPointInside(pos) | checks if a point is in the rect (position2d) |
isRectCollided(other) | returns true if this rect collides with another (rect) |
clipAgainst(other) | clips this rect with another (rect) |
getWidth() | returns the width |
getHeight() | returns the height |
repair() | repairs the rect, (makes the real lower right the lower right) |
isValid() | returns true if upperleft and lowerright corners make sense, if returns false, repair() would fix it |
getCenter() | returns the center position of the rect (position2d) |
| |
UpperLeftCorner | Member variable (position2d) |
LowerRightCorner | Member variable (position2d) |
local rect = irr.core.rect() -- creates a rect variable
rect = rect + irr.core.position2d(5,5) -- move rect + 5,5
rect = rect + irr.core.position2d(-5,-5) -- move rect - 5,5
local rect2 = irr.core.rect(1,2,3,4)
if rect2:isCollided(rect) then
print("Rectangles have collided")
end
Notes: Internally rect has a type of 's32'.
Method | Description |
triangle3d() | Creates a triangle3d object |
| |
operator == | boolean comparision operator |
| |
isTotalInsideBox(box) | determines if a triangle fits in a bounding box (aabbox3d) |
closestPointOnTriangle(p) | Returns the closest point on a triangle to a point on the same plane (vector3d) |
isPointInside(p) | Returns if a point is inside the triangle (vector3d) |
isPointInsideFast(p) | Returns if a point is inside the triangle (vector3d) |
isOnSameSide(p1, p2, a, b) | (vector3d, vector3d, vector3d, vector3d) |
getIntersectionWithLimitedLine(line, outIntersection) | Returns an intersection with a 3d line. (vector3d, vector3d ) |
getIntersectionWithLine(linePoint, lineVect, outIntersection) | Returns an intersection with a 3d line (vector3d, vector3d, vector3d) |
getIntersectionOfPlaneWithLine(linePoint, lineVect, outIntersection) | Calculates the intersection between a 3d line and the plane the triangle is on. (vector3d, vector3d, vector3d) |
getNormal() | gets the normal. The normal itself is not normalized (vector3d) |
isFrontFacing() | returns true if the triangle is front facing |
getPlane() | returns the plane of the triangle (plane3d) |
set(a,b,c) | sets the triangle (vector3d, vector3d, vector3d) |
| |
pointA | Member variable (vector3d) |
pointB | Member variable (vector3d) |
pointC | Member variable (vector3d) |
local tri = irr.core.triangle3d() -- creates a triangle3d variable
tri:set(irr.core.vector3d(1,2,3), irr.core.vector3d(4,5,6), irr.core.vector3d(7,8,9))
local norm = tri:getNormal()
print(norm.X, norm.Y, norm.Z)
Notes: Internally triangle3d has a type of 'f32'.
Method | Description |
vector2d() | Creates a vector2d object |
vector2d(X,Y) | Creates a vector2d object |
| |
operator == | boolean comparision operator |
operator + | add two vectors |
operator - | subtract two vectors |
operator * | multiply two vectors |
operator * | multiply vector by number |
operator / | divide two vectors |
operator / | divide vector by number |
| |
set(X,Y) | set the vector |
getLength() | Returns the length (number) |
dotProduct(other) | Returns the dot product (vector2d) |
getDistanceFrom(other) | Returns the distance from a point (vector2d) |
rotateBy(degrees, center) | Rotates the vector around center by 'degrees' (number, vector2d) |
normalize() | Normalizes the vector |
getAngleTrig() | Calculates the angle of this vector in grad in the trigonometric sense. |
getAngle() | Calculates the angle of this vector in grad in the counter trigonometric sense. |
getAngleWith(b) | Calculates the angle between this vector and another one in grad. (vector2d) |
getInterpolated(other, d) | returns interpolated vector (vector2d, number) |
interpolate( a, b, t) | (vector2d, vector2d, number) |
| |
X | Member variable (number) |
Y | Member variable (number) |
local v = irr.core.vector2d(3,4) -- creates a vector2d variable
local angle = v:getAngle()
local length = v:getLength()
local v2 = irr.core.vector2d(5,6)
local length2 = (v2 + v):getLength() -- get length of v2 + v
print(length, length2)
Notes: Internally vector2d has a type of 'f32'.
Method | Description |
vector3d() | Creates a vector3d object |
vector3d(X,Y,Z) | Creates a vector3d object |
| |
operator == | boolean comparision operator |
operator <= | boolean comparision operator |
operator + | add two vectors |
operator - | subtract two vectors |
operator * | multiply two vectors |
operator * | multiply vector by number |
operator / | divide two vectors |
operator / | divide vector by number |
| |
equals(other) | boolean comparision operator |
set(X,Y,Z) | set the vector |
set(other) | set the vector (vector3d) |
getLength() | Returns the length (number) |
getLengthSQ() | Returns the square of the length (number) |
crossProduct(other) | Returns the cross product (vector3d) |
dotProduct(other) | Returns the dot product (vector3d) |
getDistanceFrom(other) | Returns the distance from a point (vector3d) |
getDistanceFromSQ(other) | Returns the square of the distance from a point (vector3d) |
invert() | invert the vector |
rotateXZBy(degrees, center) | Rotates the vector around center by 'degrees' (number, vector3d) |
rotateXYBy(degrees, center) | Rotates the vector around center by 'degrees' (number, vector3d) |
rotateYZBy(degrees, center) | Rotates the vector around center by 'degrees' (number, vector3d) |
setLength(newlength) | sets the length (number) |
normalize() | normalize the vector |
getInterpolated(other, d) | returns interpolated vector (vector3d, number) |
getHorizontalAngle() | returns the horizontal angle (Y and Z rotations) |
| |
X | Member variable (number) |
Y | Member variable (number) |
Z | Member variable (number) |
local v = irr.core.vector3d(3,4,5) -- creates a vector3d variable
local angle = v:getAngle()
local length = v:getLength()
local v2 = irr.core.vector3d(6,7,8)
local length2 = (v2 + v):getLength() -- get length of v2 + v
v2:rotateXYBy(45, irr.core.vector3d(0,0,0))
print(length, length2)
Notes: Internally vector3d has a type of 'f32'.
E_ANIMATED_MESH_TYPE
|
E_MD2_ANIMATION_TYPE
|
Method | Description |
getFrameCount() | Returns the frame count (number) |
getMesh(frame, detailLevel=255, startFrameLoop=-1, endFrameLoop=-1) | Returns the IMesh interface for a frame. (IMesh) |
getBoundingBox() | Returns the bounding box of the mesh (aabbox3d) |
getMeshType() | Returns the mesh's type. One of the types listed under E_ANIMATED_MESH_TYPE. |
local amesh = scm:getMesh("sydney.md2")
local box = amesh:getBoundingBox()
scm:addAnimatedMeshSceneNode(amesh)
Method | Description |
getFrameLoop(Type) | Returns three values: outBegin, outEnd, outFps. Type is one of EMD2_ANIMATION_TYPE |
getFrameLoop(string) | Returns four values: outBool, outBegin, outEnd, outFps. Type is a string that identifies a special type. |
getAnimationCount() | Returns the number of animations |
getAnimationName(idx) | Returns an animation name based on the number. |
setCurrentAnimation(idx) | Sets the current animation to 'idx'(number). |
setCurrentAnimation(name) | Sets the current animation to "name"(string). |
local amesh = scm:getMesh("sydney.md2") -- get IAnimatedMesh
-- make sure it's ok to cast
if amesh:getMeshType() == irr.scene.EAMT_MD2 then
amesh = tolua.cast(amesh, "irr::scene::IAnimatedMeshMD2")
-- amesh now is an IAnimatedMeshMD2 object
local Begin, End, FPS = amesh:getFrameLoop(irr.scene.EMAT_RUN)
print(Begin, End, FPS, amesh:getAnimationName(irr.scene.EMAT_RUN))
end
Method | Description |
getMatrixOfJoint(jointNumber, frame) | Returns the transformation matrix of the joint. |
getJointCount(string) | Returns the number of joints. |
getJointName(num) | Returns the joint name based on a number. |
getJointNumber(name) | Returns the joint number based on a name. |
getAnimationCount() | Returns the number of animations |
getAnimationName(idx) | Returns an animation name based on the number. |
local amesh = scm:getMesh("somemesh.s3d") -- get IAnimatedMesh
-- make sure it's ok to cast
if amesh:getMeshType() == irr.scene.EAMT_MS3D then
amesh = tolua.cast(amesh, "irr::scene::IAnimatedMeshMS3D")
-- amesh now is an IAnimatedMeshMS3D object
local JointName = amesh:getJointName(0)
end
Method | Description |
getMatrixOfJoint(jointNumber, frame) | Returns the transformation matrix of the joint. |
getJointCount(string) | Returns the number of joints. |
getJointName(num) | Returns the joint name based on a number. |
getJointNumber(name) | Returns the joint number based on a name. |
getDrawableSkeleton(frame) | Returns the drawable skelton of the mesh (array |
getAnimationCount() | Returns the number of animations |
getAnimationName(idx) | Returns an animation name based on the number. |
setCurrentAnimation(idx) | Sets the current animation to 'idx'(number). |
setCurrentAnimation(name) | Sets the current animation to "name"(string). |
local amesh = scm:getMesh("dwarf.x") -- get IAnimatedMesh
-- make sure it's ok to cast
if amesh:getMeshType() == irr.scene.EAMT_X then
amesh = tolua.cast(amesh, "irr::scene::IAnimatedMeshX")
-- amesh now is an IAnimatedMeshX object
amesh:setCurrentAnimation("run")
end
EDT_DRIVER_TYPE
|