Moderators IIYAMA Posted December 7, 2012 Moderators Posted December 7, 2012 Hello, I got a question, How can I calculate a rotation of something without using "getElementRotation". I have 1 ped that is watching an object. This object will be moving arround the ped. The ped will change it's rotation when the object is moving "setElementRotation". It isn't in the sample, because this ped will be a player. -- I have 2 locations. The one of the ped and the one of the object. This is a sample: local ped = createPed ( 63, 0, 0, 3 ) local object = createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 ) function setrotation() local rotate = getPedRotation(ped) setPedRotation ( ped, rotate+40 ) end setTimer(setrotation, 100, 0) -- how can I calculate the rotation of a ped when I have the locations of the direction were the ped is watching to. local x,y,z = getElementPosition( ped ) local x2,y2,z2 = getElementPosition( object ) NO USING getElementRotation, because I have to compare with that one. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
DiSaMe Posted December 7, 2012 Posted December 7, 2012 https://wiki.multitheftauto.com/wiki/FindRotation -
Moderators IIYAMA Posted December 7, 2012 Author Moderators Posted December 7, 2012 https://wiki.multitheftauto.com/wiki/FindRotation Wooow!! I didn't even know it existed. THANK YOU!!! Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
myonlake Posted December 8, 2012 Posted December 8, 2012 https://wiki.multitheftauto.com/wiki/FindRotation Wooow!! I didn't even know it existed. THANK YOU!!! That's because it's a useful function made by a user, not a default function. For more useful functions, check this out » If I helped you, please click the like button on the right Thanks!
Moderators IIYAMA Posted December 19, 2012 Author Moderators Posted December 19, 2012 Very late reaction(sorry), thank you Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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 accountSign in
Already have an account? Sign in here.
Sign In Now