![]() |
Skyline Lua API
Version 1.0 RC1
Lua Script Reference for Skyline Game Engine.
|
#include <LUA_API_Raycast.h>
Public Attributes | |
| int | fx |
| raycast to center of screen. More... | |
| int | y = getHeightOffGround(objx,objy,objz) |
| get height off ground. More... | |
| int | z = raycastToCenterScreen() |
| int | x |
| raycast from object. More... | |
This area covers raycast functions. Set or get various raycast propertie.
Use as raycast.function()
These functions give access to basic raycasting that DOES NOT require
physics in order to work.
For more information on how these functions can be used please visit the User Manual - http://www.aurasoft-skyline.co.uk
obj = 0;
rayID = 0;
objectOffsetFromGround = 1.0;
lastPos = 0;
function onInit(objID)
obj = objID;
rayID = physics.createRay();
physics.rayDebugLines(rayID,1);
x,y,z = entity.getPosition(obj)
lastPos = y;
end
function onUpdate( td )
if(input.keyDown("left") == 1)then
entity.move(obj, 0.01, 0, 0);
end
if(input.keyDown("right") == 1)then
entity.move(obj, -0.01, 0, 0);
end
if(input.keyDown("down") == 1)then
entity.move(obj, 0, 0, -0.01);
end
if(input.keyDown("up") == 1)then
entity.move(obj, 0, 0, 0.01);
end
if(input.keyDown("z") == 1)then
entity.move(obj, 0, 0.01, 0);
end
if(input.keyDown("x") == 1)then
entity.move(obj, 0, -0.01, 0);
end
x,y,z = entity.getPosition(obj)
range = 1000;
hitID,pox,posy,posz = physics.rayFromPointByAxis(rayID, x,y,z,0,-1,0,range);
if(hitID >= 0)then
lastPos = posy;
end
if(y < lastPos+objectOffsetFromGround)then
entity.setPosition(obj, x,lastPos+objectOffsetFromGround,z);
end
end | int ray::fx |
raycast to center of screen.
Ray out from the center of the screen, similar to how and fps shoots, returns the world position of where it hits.
function onInit(objID)
x,y,z = raycastToCenterScreen();
end
| int ray::x |
raycast from object.
ray from a position in direction of dir_xyz
function onInit(objID)
x,y,z = raycastFromObject(objx,objy,objz, dirx,diry,dirz);
end
| int ray::y = getHeightOffGround(objx,objy,objz) |
get height off ground.
ray fired down and check for objects below and returns y distance
function onInit(objID)
y = getHeightOffGround(objx,objy,objz);
end
| int ray::z = raycastToCenterScreen() |