Help Support the Baja Engine! Donate to Breezeway Studios!

Baja Engine -> Forum -> Engine -> Scripting -> object contol via mouse    |   [Search Forum]

object contol via mouse

New Post New Topic New Poll
jkaoz Posted: October 21, 2007, 12:39 PM quote

Group: Testers
Member Id: 392
Joined: Oct 17 2007
Posts: 0
what I'm trying to do is control an objects rotation using the mouse.

but when i get into the game, theirs no movement, Did I screw up any place in particular?


--this is the main script--

function main()        --called when the engine starts
        mouse.visible=false        --hide the mouse        --don't worry about collisions yet
        camera.freeze=true  --disables defualt cam control
        level.load('cam_tester/cam_tester.lml')        --load our level
       --more camera stuff
        --puts camera at a null named 'start'
             --fog stuff
        --turn picker on
            --loads in the object...a textured cube
        --puts the object at a specific position via null named 'cubestart'
end --end of main funtion

function wizrotx()  --supposed to control the rotation of x
      obj.wizcube.rot.x=obj.wizcube.rot.x + 1

function wizroty()  --supposed to control the rotation of y
      obj.wizcube.rot.y=obj.wizcube.rot.y + 1

function wizrotz()  --supposed to control the rotation of z
      obj.wizcube.rot.z=obj.wizcube.rot.z + 1

function mercturn(event) --'mercturn' is what I wrote in the cubes action property in xsi
        if event=='mouse.change.y' then

The way I'm trying to setup my game is that you dont actually control the camera, but instead you control objects that the camera is parented to.

its not working, so I know I'm going about it the wrong way...
but where?
pm  email   
jkaoz Posted: October 22, 2007, 11:36 AM quote

Group: Testers
Member Id: 392
Joined: Oct 17 2007
Posts: 0
never mind I got it.
pm  email   
James Posted: October 23, 2007, 6:03 PM quote

LM Dev Team
Group: Admin
Member Id: 2
Joined: Sep 25 2004
Posts: 85
Yah, I d'no how you solved it but for future people who view this thread it should include something like this:


function perframe()
obj.wizcube.rot.y=obj.wizcube.rot.y + mouse.change.x

The events that are sent to an object are limited to just mouseclicks right now afaik. A better event model will appear in the next version that allows you to create your own events.

pm  email  www  aim  msn   
New Post New Topic New Poll