Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BUGFIX: The Y on planar vehicles' forward should always be 0
  • Loading branch information
Ricardo J. Mendez committed Dec 19, 2011
1 parent f23ae09 commit 142ccdf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Behaviors/Vehicle.cs
Expand Up @@ -343,7 +343,12 @@ protected virtual void LookTowardsVelocity (float elapsedTime)
if (Speed > MinSpeedForTurning && Velocity != Vector3.zero)
{
var newForward = _normalizedVelocity;
newForward.y = IsPlanar ? _transform.forward.y : newForward.y;
if (IsPlanar)
{
newForward.y = 0;
newForward.Normalize();
}

if (TurnTime != 0)
{
newForward = Vector3.Slerp(_transform.forward, newForward, elapsedTime / TurnTime);
Expand Down

0 comments on commit 142ccdf

Please sign in to comment.