Get point in plane where the normal crosses a GameObject in local space

Hello,
I am developing a VR game where I want to steer a boat using a steering wheel. Therefore I grab the wheel with a controller and want to turn the wheel on one axis (as wheels do) according to the controller movement.

My plan for it was to create a Vector3 plane in the script, which resembles the plane of the wheel. Then I would take the normal of it and use the Vector3.ProjectOnPlane()-Method to find the point on the plane to resemble the controller. When I have the point, I would rotate the steering wheel to this position. This procedure seems pretty complex and I don’t even know how to create a plane in local space (so that it can rotate and move with the ship).

So my question is: Is there a better way of achieving this and if no, how could my solution be implemented?

The following might work assuming the pivot point of the wheel is at the center and the top is facing up at rotation (0, 0, 0):

wheelTrs.up = controllerTrs.position - wheelTrs.position;

The following will work if the previous assumptions were true:

wheelTrs.rotation = Quaternion.LookRotation(wheelTrs.forward, controllerTrs.position - wheelTrs.position);

Please comment if the previous assumptions were false and I will let you know how to proceed.

Hey @Master109 , thanks for the fast reply :slight_smile:
The pivot point is indeed at the center, but the top isn’t facing up. The parent of the wheel is slightly tilted, but the wheel itself where the script is attached has a rotation of (0,0,0). Nevertheless I tried your approach - and it works somehow :smiley: the wheel is rotating around the Z axis - but I need it to be rotated around Y. I somewhat understand what you are doing, but I dont get how to adjust this line to do what I want to do. I tried using wheelTrs.up and wheelTrs.right, but then the wheel is just bugging around. Other adjustments that seemed to be logic didn’t do what I wanted either. What am I missing?

Also I have the player grabbing the wheel anywhere and now i want him to start from this position to turn, but I guess I just need to add the angle difference then.