store a rotation around a point
Hello,
I want to set the transform by affecting another temporary Transform to him because I am applying rotations (with Rotate and RotateAround on the temporary Transform). Sadly the transform is readonly and I can't do what I want.
I didn't found any way to store a rotation around a point in a Vector3, is it possible in another way ? I'm calculating all rotations and movement to do, and I am applying the combination of all at the end, so I need to store rotations around a point.
Edit, explanation: I have cubes on a roaler coaster who will guide the ship to stay on the rails (there have to be no physics)
see here: http://i.imgur.com/uUE6iN2.png
if the upper cube of the right group of cubes is triggered, and not the upper cube of the left group, I need to rotate the cubes around the group of cubes who is at the right place.
However, as I said:
In the Update,
I'm calculating all rotations and movement to do, and I am applying the combination of all at the end, so I need to store rotations around a point.
If several cubes are triggered, I have several movements to do, and I wan't to do them all at the same time. The problem is that I didn't found any way to store a rotation around a point (in this way I have not to apply the rotation directly with a RotateAround function) I hope my explanation made you understand
@capu I don't think I understood the question, but from your picture, (distance) = 2 radius sin(angle/2)
Answer by capu087 · Feb 20, 2016 at 10:40 PM
i did that:
tempMov = Vector3.zero;
tempRot = transform.rotation.eulerAngles;
[...]
Transform temp = transform;
tempRot.z += -threeSpeed * Time.deltaTime;
temp.rotation = Quaternion.Euler(tempRot);
Vector3 movement = transform.GetChild(1).position - temp.GetChild(1).position;
tempMov += movement;
[...]
transform.rotation = Quaternion.Euler(tempRot);
transform.position += tempMov;
it seems to work, idk if it's worth..
Your answer
Follow this Question
Related Questions
Rotation towards raycast hit point, 1 Answer
How to set limitations on rotateAround in C#? 1 Answer
Move a object around another object 0 Answers
Rotate an object around one of his childs in the self space (not the world space) 0 Answers
How to rotate object through waypoints on a curved path on sphere 1 Answer