|
Mod Faulkner
Registered User
Join date: 11 Oct 2005
Posts: 187
|
07-10-2006 09:59
I am using: vector vel = llGetVel(); float speed = llVecMag(vel); in a car script to determine speed. Once the car has started, it reports motion up to and over 3mps even when the car is not moving in any direction. Can someone explain or tell me how to correct this?
|
|
Bitzer Balderdash
Dazed and Confused
Join date: 21 Dec 2005
Posts: 246
|
07-11-2006 01:19
ummmm, no, but I would suggest that you display the vector version as well, so you can see for debugging purposes what direction you are allegedly creeping in.
could be something silly like straight down, and it is the acceleration that gravity is applying to you each frame before the collision with the ground re-zeros your speed - who knows
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
07-11-2006 03:59
You could very simply fix it by saying if the speed <3 speed=0, but that's a hack not a nice solution.
It there anything else going on? Something silly like +=llVecMag() rather than just = say?, or when stopped you're not checking llGetVel() so it's reporting it's last speed rather than it's current speed? (This might happen if you're using the controls() to trigger the speed test for example, if there's a slow process in there.
|
|
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
|
07-11-2006 09:52
I'm sure something funny is going on. There must be something else in play. In every vehicle whose speed I monitored the speed registers 0.000000 unless it was bobbing (in which case i get a very small value due to z). But not 3. That's avatar walking speed btw.
_____________________
Aodhan's Forge shop at slurl.com/secondlife/Rieul/95/213/107
|
|
Kokiri Saarinen
Quoted for truth
Join date: 7 Jan 2006
Posts: 44
|
07-11-2006 12:42
Its a common 'ghost bug' where, if velocity stop to 0, llGetVel will report a previous velocity from before stopping. I noticed this a while ago, but the script I was writing wasn't picky enough to care much. I blame SL, and Canada.
-Kokiri
|
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
07-11-2006 18:10
If you still can't figure out what the problem is, physics might simply be broken, and it would be better to use llVecMag(oldPos-llGetPos()) as your speed function.
|