Skyline Lua API  Version 1.0 RC1
Lua Script Reference for Skyline Game Engine.
camera Class Reference

#include <LUA_API_Camera.h>

Public Member Functions

void setFOV (int fov)
 This Function sets the current cameras Field of view (fov) by passing the required fov through the function. More...
 
float getFOV ()
 This Function returns the current cameras Field of view (fov). More...
 
void setFarClip (float farClip)
 This Function sets the view ports far clipping plane. More...
 
void setNearClip (float nearClip)
 This Function sets the view ports near clipping plane. More...
 
void setCameraMode (string type)
 Set the current camera mode, changing the way this camera can be used. More...
 
void setLodBias (float bias)
 Sets the lod bias to be used by the current camera. More...
 
float3 getPosition (int mode)
 This Function returns the current cameras world position.0=local space and 1=world space.
note that this arg defaults to 0 so if you require local space then you dont have to pass the arg. More...
 
void setPosition (float x, float y, float z)
 This Function sets the position of the current camera active in scene. More...
 
float4 getOrientation (int mode=0)
 This Function returns the current cameras world orientation. 0=local space and 1=world space.
note that this arg defaults to 0 so if you require local space then you dont have to pass the arg.
. More...
 
void setOrientation (float w, float x, float y, float z)
 This Function sets the orientation of the current camera active in scene. More...
 
float4 getDirection ()
 This Function returns the current cameras direction. More...
 
void setDirection (float x, float y, float z)
 This Function sets the direction of the current camera active in scene. More...
 
void attachToEntity (int entityID)
 Attaches the camera to a scene entity. More...
 
void dettachFromEntity (int entityID)
 Dettaches the camera from an entity. More...
 
void lookAtPos (float x, float y, float z)
 Makes the camera look at a specific point in the scene by world space position. More...
 
void lookAtEntity (int objID)
 Makes the camera look at a specific entity in the scene. More...
 
void getWorldOrientation ()
 Get the world orientation of the camera. More...
 
void pitch ()
 set the pitch of the camera More...
 
void yaw ()
 set the yaw of the camera More...
 
void roll ()
 set the roll of the camera More...
 
void getPitch ()
 Get the pitch of the camera. More...
 
void getYaw ()
 Get the yaw of the camera. More...
 
void getRoll ()
 Get the roll of the camera. More...
 
void setActiveCamera (int objID)
 Set the active camera. More...
 

Detailed Description

All Camera functions can be accessed through the use of this class. Use as camera.function()
For more information on how these functions can be used please visit the User Manual - http://www.chi-ad.com/Skyline/SDN/

Member Function Documentation

void camera::attachToEntity ( int  entityID)

Attaches the camera to a scene entity.

Parameters
entityIDthe object to attache this camera to. The following is a Small Example on how to use this function:
function onInit(objID)
    obj = objID
    camera.attachToEntity(obj);
end
void camera::dettachFromEntity ( int  entityID)

Dettaches the camera from an entity.

Parameters
entityIDThe entity to attach this camera to. The following is a Small Example on how to use this function:
function onInit(objID)
    obj = objID
    camera.dettachFromEntity(obj);
end
float4 camera::getDirection ( )

This Function returns the current cameras direction.

Returns
x,y,z : The current cameras world position as a float3

The following is a Small Example on how to use this function:

function onUpdate()
    x,y,z = camera.getDirection();
end
float camera::getFOV ( )

This Function returns the current cameras Field of view (fov).

Returns
The current cameras fov

The following is a Small Example on how to use this function:

function onInit(objID)
    fov = camera.getFOV();
    sky.lprint( fov ); 
end
float4 camera::getOrientation ( int  mode = 0)

This Function returns the current cameras world orientation. 0=local space and 1=world space.
note that this arg defaults to 0 so if you require local space then you dont have to pass the arg.
.

Parameters
modeAn integer of either 1 or 0 a value of 0=local space(default) and a value of 1=world space
Returns
x,y,z : The current cameras world position as a float3

The following is a Small Example on how to use this function:

function onUpdate()
    w,x,y,z = camera.getOrientation();
end
void camera::getPitch ( )

Get the pitch of the camera.

The following is a Small Example on how to use this function:

function onInit(objID)
    coming soon
end
float3 camera::getPosition ( int  mode)

This Function returns the current cameras world position.0=local space and 1=world space.
note that this arg defaults to 0 so if you require local space then you dont have to pass the arg.

Parameters
modeAn integer of either 1 or 0 a value of 0=local space(default) and a value of 1=world space
Returns
x,y,z :The current cameras world position as a float3

The following is a Small Example on how to use this function:

function onUpdate()
    x,y,z = camera.getPosition();
end
void camera::getRoll ( )

Get the roll of the camera.

The following is a Small Example on how to use this function:

function onInit(objID)
    coming soon
end
void camera::getWorldOrientation ( )

Get the world orientation of the camera.

The following is a Small Example on how to use this function:

function onInit(objID)
    obj = objID
    wx, wy, wz = camera.getWorldOrientation(Targetcamera)
end
void camera::getYaw ( )

Get the yaw of the camera.

The following is a Small Example on how to use this function:

function onInit(objID)
    coming soon
end
void camera::lookAtEntity ( int  objID)

Makes the camera look at a specific entity in the scene.

Parameters
entityIDThe entity to look at

The following is a Small Example on how to use this function:

function onInit(objID)
    obj = objID
    camera.lookAtEntity(entity.getIDFromTag("Target"));
end
void camera::lookAtPos ( float  x,
float  y,
float  z 
)

Makes the camera look at a specific point in the scene by world space position.

Parameters
xThe X Axis position in world space to look at
yThe Y Axis position in world space to look at
zThe Z Axis position in world space to look at The following is a Small Example on how to use this function:
function onInit(objID)
    obj = objID
    camera.lookAtPos(0, 0, 0);
end
void camera::pitch ( )

set the pitch of the camera

The following is a Small Example on how to use this function:

function onInit(objID)
    coming soon
end
void camera::roll ( )

set the roll of the camera

The following is a Small Example on how to use this function:

function onInit(objID)
    coming soon
end
void camera::setActiveCamera ( int  objID)

Set the active camera.

You can set the active in scene camera from this command, good for cutscenes

The following is a Small Example on how to use this function:

function onInit(objID)
    camera.setActiveCamera( cam1ID );
end
void camera::setCameraMode ( string  type)

Set the current camera mode, changing the way this camera can be used.

Parameters
type:Set the current camera mode to the value specified in the variable type.

The available modes are:

"Fly"
"LookOnly"  --  FIXME :: Broke
"Fixed" 

The following is a Small Example on how to use this function:

function onInit(objID)
    camera.setCameraMode("Fly"); 
end
void camera::setDirection ( float  x,
float  y,
float  z 
)

This Function sets the direction of the current camera active in scene.

The following is a Small Example on how to use this function:

function onInit()
    x,y,z = 0;
    camera.setCameraMode("Fixed"); -- set to fixed to allow you to change rotation without internal engine taking over due to "Fly" mode.
    camera.setDirection(x, y, z);
end
void camera::setFarClip ( float  farClip)

This Function sets the view ports far clipping plane.

Parameters
farClip: Pass the value in farClip to set the view ports far clipping distance.

If you set the Farclip value to 0, then you will have an infinite rendering distance. This may not be performance friendly in some games,
be careful how you use it otherwise you will see Framerate drop.

The following is a Small Example on how to use this function:

function onInit(objID)
    camera.setFarClip(1000); 
end
void camera::setFOV ( int  fov)

This Function sets the current cameras Field of view (fov) by passing the required fov through the function.

Parameters
fov: Pass a float value to represent the fov you would like to set.

The following is a Small Example on how to use this function:

function onInit(objID)
    camera.setFOV(90);
end
void camera::setLodBias ( float  bias)

Sets the lod bias to be used by the current camera.

Parameters
bias: use the variable bias to set the scenes current lod bias level.

The lod bias has an effect over how the scenes lodding system works. This will effect the terrain and material lods.
The following is a Small Example on how to use this function:

function onInit(objID)
    camera.setLodBias(0.40);
end
void camera::setNearClip ( float  nearClip)

This Function sets the view ports near clipping plane.

Parameters
nearClip:Pass the value in farClip to set the view ports near clipping distance.

The value you pass through must not be 0, as this will crash your script everytime.

The following is a Small Example on how to use this function:

function onInit(objID)
    camera.setNearClip(1); 
end
void camera::setOrientation ( float  w,
float  x,
float  y,
float  z 
)

This Function sets the orientation of the current camera active in scene.

The following is a Small Example on how to use this function:

function onInit()
    w,x,y,z = 0;
    camera.setCameraMode("Fixed"); -- set to fixed to allow you to change rotation without internal engine taking over due to "Fly" mode.
    camera.setOrientation(w, x, y, z);
end
void camera::setPosition ( float  x,
float  y,
float  z 
)

This Function sets the position of the current camera active in scene.

The following is a Small Example on how to use this function:

function onInit()
    x,y,z = 0;
    camera.setPosition(x,y,z);
end
void camera::yaw ( )

set the yaw of the camera

The following is a Small Example on how to use this function:

function onInit(objID)
    coming soon
end

The documentation for this class was generated from the following file: