Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Triggering vehicle motors

Jacqueline Trudeau
Nogoodnik
Join date: 9 Jul 2005
Posts: 171
12-13-2006 16:02
I'm trying to get my vehicle's angular motor to respond to something other than keystroke input.

From a standstill this works:

CODE
control(key id, integer level, integer edge) {
if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT)) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,<PI*4,0.0,PI*4>);
}
}

As does this:

CODE
touch(integer total_number) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,<PI*4,0.0,PI*4>);
}

However, this does not:

CODE
listen(integer channel, string name, key id, string message) {        

if(message == "LEFT") {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,<PI*4,0.0,PI*4>);
}
}

Nor does this:

CODE
timer() {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION,<PI*4,0.0,PI*4>);
}


The last two examples *do* work if the vehicle is already moving, but the first two examples work from a standstill as well. Does anyone have any insight into this? Thanks so much :)
_____________________
http://trudeauyachts.wordpress.com
Aaron Edelweiss
Registered User
Join date: 16 Nov 2006
Posts: 115
12-13-2006 17:36
Certain events cause a slight movement in an object/avatar for no real reason. This can let things like the motors overcome friction. Solution, a slight bump up with llApplyImpulse, very small, just enough to make it twitch, which emulates that same small movement. it's a hack, but it's SL.
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
12-13-2006 19:02
The first two events are called repeatedly while the key or mouse button is pressed, the third one (listen) is called only once, and the timer depends on the rate. Sounds like the last two are not frequent enough to overcome friction, so check your friction/efficiency numbers.
~Boss
Jacqueline Trudeau
Nogoodnik
Join date: 9 Jul 2005
Posts: 171
12-14-2006 05:49
Thanks guys! I'll give it a go.

Boss, I thought about that too - the touch and control events buffer multiple "hits". I tried this to emulate that:

CODE
listen(integer channel, string name, key id, string message) {

if(message == "LEFT") {

integer i;

while (i < 10) {
llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRE CTION,<PI*4,0.0,PI*4>);
i += 1;
}
}
}


But that seemed to make no difference - no movement. As Aaron suggested, it looks like the object must have *some* small bit of movement already before the motors respond to certain programmatic stimulus.
_____________________
http://trudeauyachts.wordpress.com