RygtY Posted August 12, 2014 Share Posted August 12, 2014 Hi I went through the Object script tutorials and I've gotten that crate model to rotate. I've also tested out the Pick example for the Camera class. Now my question how do I make a Camera object that I placed in the editor to do a "Pick" on the crate model then have that model rotate (and maybe even play a sound)? Quote Link to comment Share on other sites More sharing options...
YouGroove Posted August 12, 2014 Share Posted August 12, 2014 Inspired from FPSPlayer.lua function Script:UpdateWorld() ... if window:KeyHit(Key.E) then local p0 = self.camera:GetPosition(true) local p1 = Transform:Point(0,0,self.useDistance,self.camera,nil) if self.entity.world:Pick(p0,p1, pickInfo, 0, true) then if self.entity:GetType() = "crate" then self.entity:SetOmega(10,10,10) end end end ... end For sound commands you cna dig AI ro FPSPlayer lua scripts. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
RygtY Posted August 12, 2014 Author Share Posted August 12, 2014 So where should I attach such a script? Also how do I make a script that can reference the camera I've placed using the editor than in a script file? I need some help in reconciling the two possible ways to make a camera in the engine either by scripting it or using the editor. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted August 12, 2014 Share Posted August 12, 2014 The script above like you can see is on the UpdateWorld(). Inside your script just declare an empty entity : Script.myCamera = nil -- entity The word "--entity" will make some empty field in the script panel where you can drag and drop the camera. To use it in your functions just use it like that : self.myCamera:SetPosition(0,0,0,false) You would recommend you to ask Rick for some learning course on Lua and LE3 as he gives courses for beginners. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.