Arching and Rotating arrow.


I have a script that shoots arrows on click. To make the arrow face towards where it’s going, I’m setting it’s transform.rotation to it’s velocity while it’s flying:

if (rb.velocity.magnitude > 5) {
Quaternion q1 = Quaternion.LookRotation (rb.velocity);
rb.transform.rotation = q1;

This works great. So now trying to make the arrow spin as it’s flying:

rb.AddRelativeTorque (new Vector3(0,0,10000000));

I am unable to get any other rotation out of it using torque. Is this because I’m hard setting transform.oration each frame?

Whats the best practice for me to add rotation to this arrow? Should it be another Quaternion that I multiply to this one before applying to rotation? I’ve tried something like this with no luck:

Quaternion q2 = Quaternion.Euler(Vector3.forward * 20);
rb.transform.rotation = q1 * q2;

Thanks for your help!

I was able to do this (BUT STILL would like best practice advice!)

I achieved this by creating a parent object for the arrow that holds the rigidbody and collider. This parent object has the mesh of the arrow as a child with no rigidbody.

I used the same method of arcing, then used

transform.Rotate(Vector3.forward * 1500 *Time.deltaTime);

on the mesh to make it spin instead of Torque.

I don’t think this is the best solution however, any other suggestions is greatly appreciated.