I’ve encountered a roadblock.
I’m trying to make a hand (just a rectangle) that rotates so the palm is on the cursor. I can handle the extending of the hand, but I can’t seem to figure out to do this.
mspaint diagram of what I need.
Basically, I need to rotate the hand around the far left edge-point of the hand (which I have), so that it faces the cursor.
I’ve tried using:
hand.transform.RotateAround(handEdge, Vector3.forward, Quaternion.LookRotation(Vector3.forward, Vector3.Cross(hand.transform.position - mouseKinematics.GetCursorScenePos(), Vector3.forward)).z);
Where handEdge
is the point I want to set rotation relative from.
But transform.RotateAround()
is a incremental change.
I’ve also tried:
hand.transform.rotation = Quaternion.LookRotation(Vector3.forward, Vector3.Cross(hand.transform.position - mouseKinematics.GetCursorScenePos(), Vector3.forward));
But it resulted in wonky rotation that was close, but not around the point I need.
I’m really not even sure I’m on the right track, but I can’t find any kind of references for this kind of thing.
Any advice would be really helpful!
Spider is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.