Harry Potter's Wand problem, MouseLook script

Hey Yall, I’m a few months into the Unity3d scripting but I could definitely use some help with some of the movement scripts.

What I’m trying to do:
I’m trying to rotate Harry Potter’s wand in his hand. When he’s in a dark room the end of the wand lights up. I want his wand to rotate at the end that harry’s hand touches so that he can move the light around in the dark.

What I’m using:
I’ve attached a MouseLook script to the wand.

The wand rotates around the end of the lighted end instead of rotating around where Harry’s hand is. Therefore, instead of the lighted tip pointing at the mouse’s position, the handle moves around, opposite to the given mouse coordinates.

Although I have tried moving the wand in different locations, the point that it rotates around stays the same.

How do I change the orientation of the mouse look script to rotate around the handle’s axis?
What is the best way to make Harry’s wand operate correctly.

the transform’s rotation is always in terms of world axes so if you have a specific local rotation that you need to apply, you need to:

  • declare a quaternion and store the original object rotation there
  • rotate the object by the intended means and direction
  • multiply the rotated quaternion by the original rotation

This way, you’ll actually ‘restore’ the original axes rotation, in the transformed object.

Why would you use a quaternion as opposed to a Vector3 matrix?