Jump to content

Convert Velocity to Integer


Miguelito Shilova
 Share

You are about to reply to a thread that has been inactive for 3506 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi there. I'm working on a speedometer script and I need to convert the velocity vector to an integer. I'm thinking that I can use llGetVel for starters. SLWiki notes that to get the velocity relative the local frame (the direction the object is pointing), divide the output of this function by that of its rotation.," and provides the folloiwing to do that ...

vector local_vel = llGetVel() / llGetRot();

If I declare an integer 'number', how can I convert 'local_vel' to an integer that represents the speed in the forward/backward direction?

-- Mig

Link to comment
Share on other sites

No, you already have your local_vel, which is a vector.  What you asked about is speed, which is the magnitude of a vector.  And you wanted an integer version of that, so ....

integer Speed = (integer)llVecMag(local_vel);

EDIT:  You type too fast.   Yes, you could typecast with llRound or llFloor too.  :smileywink:

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3506 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...