I’m having a hell of a time trying to wrap my head around how to handle this… need suggestions.
I have a set of wheels on an axel attached to a mock-vehicle (you can probably think of this kinda like a trailer) by a strut in the middle of the axel. This wheel assembly should rotate ‘freely’ along it’s Y rotation.
I have another gameobject, a leveraging bar, that attaches to the axel between the wheels. This bar should rotate ‘freely’ around it’s attachment point on the Z and X axis.
These objects can’t be parented to one or the other as they each have separate rigidbodies.
I also have a third gameobject, a player-controlled vehicle, that will be leveraging this bar around, but that might be unrelated to the solution.
I need the wheel assembly to follow the attachment point along it’s Y axis only, so the bar can position itself properly on the other two axis, but I can’t find a working solution.
I thought ProjectOnPlane and LookAt/LookRotation would be what I needed, but those gave me seemingly random rotations.
I also tried a few variants of LocalEulerAngles, but those would inconsistently break with negative angles.
RotateAroundPoint seemed good until I realized it was the inverse of that I needed.
I feel like i’m missing something simple, but I have no idea what.
This video shows the closest-working thing, but it’s just a LookAt().
I need the wheel on the left to rotate so the strut coming out of the top does not move, just rotate.
This is the angle the strut should be at:
