Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Strange behavior in vehicle

Fenix Eldritch
Mostly harmless
Join date: 30 Jan 2005
Posts: 201
03-16-2007 10:00
I've been using Jester Knox's heavily commented hover car script to get my feet wet with vehicle scripting. For the most part, every thing's working alright - with the exception of the strafe left part.

I haven't made any changes to the original code in /54/96/52097/1.html save for tweaking some of the values - but even from the start the left strafe never worked. Oddly enough, the if block that is supposed to catch the Shift + Left Key is working. I know because I dropped a llSay() into it and it happily spamed the chat when tried to strafe left. For whatever reason, it's not updating the linear.y, but I don't understand why.

CODE
// when shift and the left arrow or shift and a is pressed ------------
if (level & CONTROL_LEFT)
// strafe left
{
linear.y += 10.0 ;
//angular.x -= (PI / 180) * 55.0 ;
}
// when shift and the left arrow or shift and a is released
else if (!(level & CONTROL_LEFT))
// stop strafeing left
{
linear.y = 0 ;
}

// allows us to alter the speed based on the pilot/driver's input
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, linear);
// lets us turn
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular);


Even more puzzling to me is that the code to strafe right is nearly identical to this and it works perfectly.
Sterling Whitcroft
Registered User
Join date: 2 Jul 2006
Posts: 678
03-16-2007 14:20
The forums occasionally add extra spaces where they don't belong.
This should read...

llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, linear);
// lets us turn
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular);

Without the extra spaces in the 'MOTOR_DIRECTION' variable name.

====
Sorry, Fenix. Didn't mean to insult...it was just the first and most obvious thing. I'll try in world, the script you reference. :)
Fenix Eldritch
Mostly harmless
Join date: 30 Jan 2005
Posts: 201
03-16-2007 15:42
I'm aware of that. My in-world code is correct in that respect - otherwise it wouldn't compile at all, which mine does.

I was just being lazy when I copy & pasted my code into the forum. :P