Simple0x47 Posted March 25, 2019 Posted March 25, 2019 You should have three positions ( one of them is the reference ) in order to obtain an angle.
AncienT Posted March 25, 2019 Author Posted March 25, 2019 (edited) 38 minutes ago, Simple0x47 said: You should have three positions ( one of them is the reference ) in order to obtain an angle. i made this: --FORMULA: cos(0)=a*b/|a||b| local x1,y1,z1 = 4,-3,5 local x2,y2,z2 = 9,7,-10 local r1 = (x1*x2)+(-3*7)+(5*-10) local a1 = x1^2+(-y1)^2+(z1)^2 local a2 = x2^2+(-y2)^2+(z2)^2 local r2 = math.sqrt(a1)-math.sqrt(a2) local angle = r1/r2 print(angle) I just do not know if it's the correct formula Edited March 25, 2019 by AncienT
Simple0x47 Posted March 25, 2019 Posted March 25, 2019 For what do you need the angle? Because you cannot get the angle of 3D points.
Investor Posted March 26, 2019 Posted March 26, 2019 If you're looking for the Z rotation (bearing, yaw) between two points: findRotation. If you need the local Y (pitch) it can be computed in a similar way to findRotation. The local X (roll) rotation is not defined, so to speak, when looking towards another 3D position (i.e. it can be anything) unless you introduce some additional reference point perhaps.
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