Patch Lamington
Blumfield SLuburban
Join date: 2 Nov 2005
Posts: 188
|
01-17-2006 05:17
Was trying to determine whether my car was going forward or back, so naturally turned to the wiki. Re-use is king  Under llGetVel, the following example is given: vector global_velocity = llGetVel(); vector local_velocity = global_velocity * llGetRot();
This gave me nonsense results - at some angles it would report a negative x velocity when it should have been positive, and vice versa - but changing the multiply to a divide gave me results that work reliably (for me at least). Now all I have to do is stop the car sinking into the road every time I cross a sim border, bring world peace, stop global warming and then home for tea  (ps. I've commented but not edited the wiki - case anyone knows better than me how/why this works)
_____________________
Blumfield - a regular everyday kind of 'burb in an irregular world. This notice brought to you by the Blumfield Visitors and Residents Bureau.
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
01-17-2006 07:16
Strange... llGetVel() * llGetRot() should get you the local velocity. Perhaps it was the variable assignment that was causing a small amount of lag, and thus problems.
|
Patch Lamington
Blumfield SLuburban
Join date: 2 Nov 2005
Posts: 188
|
01-17-2006 08:21
Dont think lag was to blame... Considering that it was a car where almost all motion is in x, the original (with the multiply) gave results with large y components to the velocity, and x components that varied in sign. The revised version gives only small y components (as would be expected when turning), and x components that seem reasonable for the car motion. Has anyone else tested this? ps If I have the time, Ill happily demo this to anyone who thinks they might be able to solve it  I should be online in a few hours time
_____________________
Blumfield - a regular everyday kind of 'burb in an irregular world. This notice brought to you by the Blumfield Visitors and Residents Bureau.
|
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
|
01-17-2006 08:43
vector local_velocity = llGetVel() / llGetRootRotation();
|