Does anyone know how to set the axis of a hinge joint to be perpendicular to the forward vector of another transform? I need the hinge to swing in the direction and player is facing so the axis must be perpendicular to the way the player is facing. Also the axis for a hinge joint is in local space. I have been pulling my hair out trying to figure this out so any help will be greatly appreciated.
First part isn’t really a hinge Q. An easy way to get perpendicular to forward is just transform.right
. Or, if you need it “flat,” take the cross product with Vector3.up
(which is the same thing as transform.right
, if you aren’t leaning over.)
I feel like hinges joints might be in world coords (which is easier, if true, since you usually know the hinge is often “coming from” something world coords, and not from you.)