These forums are CLOSED. Please visit the new forums HERE
Forward Velocity |
|
Karsten Rutledge
Linux User
![]() Join date: 8 Feb 2005
Posts: 841
|
03-21-2005 12:10
I need to know only the forward velocity of an object (X on local axis). According to the Wiki, this can be attained by multiplying llGetVel() by llGetRot(), however this doesn't seem to work. When I do this and pull the .x component out of the resulting vector, it doesn't seem like I end up with forward velocity. Accelerating in different directions causes this number to vary between negative and positive in a rather useless fashion. Has anyone had any success with this functionality before?
|
Alpha Zaius
llLol()
![]() Join date: 13 Mar 2004
Posts: 1,187
|
03-21-2005 13:02
Hello!
The best way to get the forward velocity in meters / second would be: CODE
For more information about llVecMag() you can go to http://secondlife.com/badgeo/wakka.php?wakka=llVecMag _____________________
|
Cross Lament
Loose-brained Vixen
![]() Join date: 20 Mar 2004
Posts: 1,115
|
03-21-2005 15:35
This would be an application of the dot product, wouldn't it? Somebody catch me if I'm completely wrong, here.
![]() Code snippet: CODE // Gets the 'unit vector' showing which way the x-axis (forward) is pointing _____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?" |
Karsten Rutledge
Linux User
![]() Join date: 8 Feb 2005
Posts: 841
|
03-22-2005 07:11
Thanks! I'll give that a try after work tonight.
|
Cross Lament
Loose-brained Vixen
![]() Join date: 20 Mar 2004
Posts: 1,115
|
03-22-2005 09:44
Hehe, let me know if it works! I'm curious, too.
![]() _____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?" |
si Money
The nice demon.
Join date: 21 May 2003
Posts: 477
|
06-29-2005 07:55
For the interested -- I was trying to do this the other day, and it seems the math here is slightly flawed (or I just read it wrong, over and over).
It actually comes out more along the lines of: vector myVel = llGetVel(); rotation myRot = llGetRot(); vector myFwd = llRot2Fwd(myRot); vector localizedVel = myFwd * ((myVel * myRot) * myFwd); I'm no good with this sort of math, so i'm not sure if this is the right or most efficient way to do this -- however, it seems to work, where the one before (without adjusting the velocity with the rotation) seems to return it in a global sense. If someone can more efficiently do this math, or provide an explanation of why it needs this, i'd appreciate it. _____________________
Like a soul without a mind
In a body without a heart I'm missing every part -- Progress -- Catherine Omega: Yes, but lots of stuff isn't listed. "Making UI harder to use than ever" and "removing all the necessary status icons" things.... there's nothing like that in the release notes. ![]() |
Buster Peel
Spat the dummy.
Join date: 7 Feb 2005
Posts: 1,242
|
07-06-2005 00:37
Here's what I use:
vector curVel = llGetVel() / llGetRot(); |