eXo|Flobu Posted November 19, 2008 Share Posted November 19, 2008 Or you can make something that could help others a lot. Since not many are good enough to know how to calculate positions out of a position, rotation and distance, (like me... ^^) a resource/script to calculate these things would help quite some people quite much! So people can make their gamemodes a bit more professional and add a lot of their ideas of which they'd originally think that it wouldn't be possible. Suggestion for a function: float,float,float calculatePosition(float x, float y, float z, float rotx, float roty, float rotz, float distance) Or something. Might not be hard, but it is to me! ^^ this work but i don't know how i would use the y rotation because this changes the z rotation. I don't know in which ways it changes. the coordinates are not exactly correct because of rounding variables in lua script and its trigonometric functions function calculatePosition3D(xOld, yOld, zOld, rx, ry, rz, distance) local xNow,yNow,zNow local a = math.cos(math.rad(rx))*distance xNow = xOld - math.sin(math.rad(rz))*a yNow = yOld + math.cos(math.rad(rz))*a zNow = zOld + math.sqrt( distance^2 - a^2 ) return xNow,yNow,zNow end sry for my bad english Link to comment

DefiniteIntegral Posted November 20, 2008 Share Posted November 20, 2008 Why include a y rotation? You only need X and Z when you are transforming relative to GTA world space, since the world coordinates have constant orientation. Even if you are transforming relative to a vehicles orientation Y rotation still isn't necessary since it only controls the vehicles roll. I am not sure about ped orientations. Link to comment

## Recommended Posts

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account## Sign in

Already have an account? Sign in here.

Sign In Now