- Home /
offset on Configurable Joint target rotation
Hello, I want to have an offset (-90 on z) on the rotation. How can I do that? This is my script:
public class CopyMotion : MonoBehaviour
{
public Transform targetLimb;
public bool mirror;
ConfigurableJoint cj;
// Start is called before the first frame update
void Start()
{
cj = GetComponent<ConfigurableJoint>();
}
// Update is called once per frame
void Update()
{
if (!mirror)
{
cj.targetRotation = targetLimb.rotation;
}
else
{
cj.targetRotation = Quaternion.Inverse(targetLimb.rotation);
}
}
}
Thanks for help!
what offset? rotation? position? local? global? which end?
Please give more and exact details on what you are searching for...
Answer by rage_co · Jul 06, 2021 at 04:12 PM
i don't know Quaternions well so you'd have to figure the format out yourself or wait for a more educated answer....but i think your should do
cj.targetRotation = targetLimb.rotation - new Quaternion.eulerAngles(0f ,0f, 90f);
i think it should do...but if it doesn't try
cj.targetRotation = targetLimb.rotation - new Quaternion(0f, 0f, 0f, 0.5f);
I am not well acquainted with quaternions so i do not know the accuracy of these....i hope this works tho...tell me if it does
well then please tell Captain pineapple the details of the problem in the comments for the question....he can help you
I looked a bit more in the internet and then I saw you have to multiply it not add or deduct it. So I changed the - with *
Your answer
Follow this Question
Related Questions
Configurable Joint - How does TargetRotation work? 2 Answers
Set ConfigurableJoint targetAngularVelocity towards targetRotation 0 Answers
How does ConfigurableJoint's TargetRotation works? 1 Answer
Getting a configurable joint to point at another object 2 Answers
I wonder about AssetBundle Load 0 Answers