Moderators IIYAMA Posted December 7, 2012 Moderators Share 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. Link to comment
DiSaMe Posted December 7, 2012 Share Posted December 7, 2012 https://wiki.multitheftauto.com/wiki/FindRotation Link to comment
Moderators IIYAMA Posted December 7, 2012 Author Moderators Share Posted December 7, 2012 https://wiki.multitheftauto.com/wiki/FindRotation Wooow!! I didn't even know it existed. THANK YOU!!! Link to comment
myonlake Posted December 8, 2012 Share 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 » Link to comment
Moderators IIYAMA Posted December 19, 2012 Author Moderators Share Posted December 19, 2012 Very late reaction(sorry), thank you 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 accountSign in
Already have an account? Sign in here.
Sign In Now