I have a floating boat that I am trying to control with pure physics, however thus far it hasn’t been working that well, beyond the buoyancy which works perfectly.
At the moment, I’ve got a vague target look-at that rotates, however it tends to over-shoot and then won’t stop when it gets to the target, resulting in a weird orbit. What I want to do is keep it from over-shooting when it’s lined up with the target, and then move to the destination and finally stop, until the destination changes.
This is the code producing the not-quite-working effect:
TargetLocation = TempTarget.position;
Vector3 Heading = TargetLocation - transform.position;
float direction = Vector3.Dot(Heading, -transform.forward);
float Distance = Vector3.Distance(TargetLocation, transform.position);
Debug.Log("Direction Status: " + Mathf.Sign(direction));
if (Distance > 1.5f)
{
// Is the Target in front or behind me? //
// In Front //
if (Mathf.Sign(direction) == 1)
{
currentThrustPower = 600;
} else
{
currentThrustPower = 0;
}
if (direction < 0.55f)
{
torquePower = 1400;
}
else
{
torquePower = 0;
}
} else {
currentThrustPower = 0;
torquePower = 0;
}
RTorque = new Vector3(0, 0, torquePower);
Vector3 forceToAdd = -transform.up * currentThrustPower;
boatRB.AddRelativeTorque(RTorque);
boatRB.AddForceAtPosition(forceToAdd, waterJetTransform.position);

I see. Yeah there is no drag applied to my player, so the player is always faster in the air, because friction comes into play on the ground. You slowed him in the air to fix it, I sped him up on the ground by removing friction while in motion. I will fool around with your solution and see if that works better for me, but right now my movement works great.
– brlan10For sure, they're both viable in isolation, but who knows if removing friction will result in some unintended consequence later in development - which is why I'm so wary about workarounds like this. I feel your solution is a bit more sound.
– brlan10