Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I want to create tires that turn dynamically based on mouselook direction

Kwipper Manimal
Registered User
Join date: 12 Jan 2005
Posts: 52
04-28-2006 10:22
I have created a car that uses the mouselook to turn. However I want to make my front tires turn dynamically towards the direction my mouselook is pointing. I cannot figure out how to do this though through coding, but I suspect it involves the same methods that people use to make turret guns.

Does anyone have any idea or code examples they can show me on how to do this?
Gattz Gilman
Banned from RealLife :/
Join date: 29 Feb 2004
Posts: 316
04-28-2006 15:24
first, you need llGetAgentInfo() to check if the avatar is in mouselook (and you could you llForceMouselook() to put them in mouselook on sit). Then in a timer() event, check the camera rotation llGetCameraRot() (You need to have the avatar give permission PERMISSION_TRACK_CAMERA). Take the value there and use a link message to send the rotation to the wheels' script and there, the wheels set their rotation (which will probably use llSetLocalRot()).

Now, this wont be as smooth, but that will depend on the interval you set your timer at.

Also, you might want to limit how far the wheels can turn left and right. since the camera in mouselook has a 180 degree field of vision.
_____________________
Kwipper Manimal
Registered User
Join date: 12 Jan 2005
Posts: 52
04-29-2006 05:48
Okay. I am going to try and take this in a step by step fashion. First the mouselook script

I have a force mouselook script, in a seperate script.

CODE

default
{
state_entry()
{
llForceMouselook(TRUE);
}

on_rez(integer start_param)
{
llForceMouselook(TRUE);
}
}


Would it work even if the force mouselook is in an individual script, or does it need to be in the same script as the wheel turning script?