- Home /
Question by
JenoahKers · Jul 28, 2020 at 12:28 PM ·
rigidbodyquaternionspeedmathangleaxis
How can I adapt the AngleAxis speed to match my rigidbody speed?
Hi all,
I am currently working on a game where the player can switch between regular driving and steering by grappling. At this point, I have got both mechanics working, except for the transition between them as the speed it uses for the rotation is different than that from the regular driving. It has something to do with the formula, but I am no wizard on math yet, so I need some help.
Quaternion q = Quaternion.AngleAxis(radius * (currentSpeed * Time.deltaTime), Vector3.up);
rb.MovePosition(q * (rb.transform.position - fixedGrapplePoint) + fixedGrapplePoint);
rb.MoveRotation(rb.transform.rotation * q);
The code that I have here is the code that is called when the player grapples. It used the Quaterion.AngleAxis where the radius is the distance between the grapple point and currentSpeed is the velocity of the rigidbody (rigidbody.velocity.magnitude).
Is anyone able to help me with the soccery? Mashing my head with this for a while now :)
Thanks upfront!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613004245im_/https://answers.unity.com/themes/thub/images/avi.jpg)