2kristof2 Posted November 27, 2017 Posted November 27, 2017 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.
Moderators IIYAMA Posted November 27, 2017 Moderators Posted November 27, 2017 What has position in your case to do with rotation? If you have 2 positions, then it would be something else. getElementRotation
2kristof2 Posted November 28, 2017 Author Posted November 28, 2017 The element is attached and getElementRotation won't return actual rotation but rotation before attaching. And yes I know all those functions related to attachments but there are needed even more complicated maths to rotate an element by setting its offsets.
Moderators IIYAMA Posted November 28, 2017 Moderators Posted November 28, 2017 Yea, thought you missed something in your explanation. You can try to check with getElementMatrix. But I can't help you getting rotations from rotation offsets of matrices, too much for me.
2kristof2 Posted November 28, 2017 Author Posted November 28, 2017 3 hours ago, IIYAMA said: I tried with getElementMatrix but it seems like it doesn't return correct rotations, at least not everytime (there is an option to get rotation from matrix using OOP, this is what I used)
szekelymilan Posted November 30, 2017 Posted November 30, 2017 (edited) 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 November 30, 2017 by MakroBox
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