Jump to content

Element's rotation from XYZ axes?


2kristof2

Recommended Posts

Hello,

I would like to know how to get rotation of an element (rx,ry,rz) if I have its x,y,z axes and their positions (P1, P2, P3 and element's position are given like in the picture below). Some maths are needed but unfortunately calculating angles is not my strong side. Thanks in advance.

Ez0yurP.png

 

Link to comment

element1
element2 -> attached to element1

When you attach these two, get the rotation of element1, and element2. Save them in a table (rotations).
Then, when you are trying to get the element2's actual rotation, just get the rotation of element1, and have 3 new variables:
differenceX = rotations['element1'][1] - getElementRotation(element1)[1] -- make differenceY and differenceZ like this
Then, you can get the element2's rotation, with rotations['element2'][1] + differenceX, or if it's not working, use - of + instead.


I hope this can be working! ;)

Edited by MakroBox
Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...