Hello All,
I am tyring to use the findchild command to animate a model in a scene file.
Does anyone know what i am doing wrong with my lua script. I get the model to just move a little bit then stop.
Help what am i doing wrong?
Thank you,
Leroy
require("Scripts/constants/engine_const")
//Register the Path
RegisterAbstractPath("")
//Setup the display mode
Graphics(800,600)
//Frame Work of the leadwerks
fw = CreateFramework()
//Setup the camera
camera = fw.main.camera
camera:SetPosition(Vec3(0,2,-10))
camRotation=Vec3(0,0,0)
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
HideMouse(1)
//Home made scene
scene = LoadScene("abstract::leroy1.sbx")
//Find Inworld Camera
cameraleroy = scene:FindChild("start")
AppLog(cameraleroy)
//Position Camera in start point
fw.main.camera:SetPosition(cameraleroy:GetPosition())
framebegin = 0
frameend = 0
frame =0
//Find animated engine inworld
leroyengine = scene:FindChild("engineone")
while KeyHit(KEY_ESCAPE)==0 do
//Animate engine model
framebegin=100.0
frameend=227.0
frame=AppTime()/100.0
frame=frameend-framebegin+framebegin
Animate(leroyengine,frame,1.0,0,true)
UpdateAppTime()
//Camera Look Around
gx=Curve(MouseX()- GraphicsWidth()/2,gx,10)
gy=Curve(MouseY()- GraphicsHeight()/2,gy,10)
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
camRotation.x = camRotation.x+gy /10
camRotation.y = camRotation.y-gx /10
camera:SetRotation(camRotation,1)
//Run engine inworld
//keys
move = Curve(KeyDown(KEY_W)-KeyDown(KEY_S),move,10)
strafe = Curve(KeyDown(KEY_D)-KeyDown(KEY_A),strafe,10)
camera:Move(Vec3(strafe /15,0,move,15))
fw:Update()
fw:Render()
Flip(0)
end