How do I rotate a vector please? (image included)

I am having a problem rotating a vector. In the image you can see I have a vector, and I want to create another vector “attached” to the end of the old vector, but rotated 45 degrees. But the problem is that I am using Quaternion.AngleAxis to rotate the new vector, which seems to be rotating it around the middle of the vector like in Example 2, meaning the beginning of the new vector isn’t the same as the end of the old vector.

This is for position syncing over a network. Thanks for any help.


You are mixing the rotation of vectors and the rotation of objects (based on your drawing. Vectors don’t have position. So assuming these are real world objects, then you need do something so the rotation pivot point changes:

  • Change the pivot using and editor script
  • Change the pivot in a modeling program
  • Put an empty game object at the pivot point and make the visible object a child. Rotate the empty game object.
  • Use RotateAround() or something similar that specifies a pivot point.