- Home /
Adding quaternions using a seperate axis
Question
Let's say there are two gameobjects A and B. Gameojbect A needs to be rotated around specified axis whenever gameobject B is rotated in such a way that it does not rotate around its own axis but that of the world.
In essence the rotation of B needs to be added to A. However, when the quaternions of A and B are added (as done below) the rotation is done around the local axis. The multiplication operator needs to be replaced by a more specific function.
_targetObject.transform.rotation = Quaternion.RotateTowards(
_targetObjectRot * HandRotRel,
quaternionTransform(HandInstance.Rotation),
Time.deltaTime * 0.1f);
Background
The code above works well and follows the rotation of the hand (gameobject B). The idea is that the rotation of a recognized hand is used to add to the rotation of the targetobject (gameobject A). The hand recognition can be turned off and on which allows for the targetobject rotation to be changed in increments.
Your answer
Follow this Question
Related Questions
transform.rotate 4 Answers
The best way for working with rotation in 2d game 1 Answer
Adding Rotation to a Gameobject 1 Answer
How to use a negative value when MathF.Clamping a eulerAngle? 1 Answer
Rotate Issue 0 Answers