less sticky movement
This commit is contained in:
@@ -318,14 +318,37 @@ namespace Game
|
||||
else if (player.CameraM == CameraMode::Walk)
|
||||
{
|
||||
auto newTransform = player.PlayerCamTransform;
|
||||
TranslateLocal(newTransform, {0.0f, 0.0f, inputVec.z});
|
||||
TranslateLocal(newTransform, {inputVec.x, 0.0f, 0.0f});
|
||||
// Global and local are inverted because camera
|
||||
Vec3 globalInput = GlobalToLocalDirection(newTransform, {inputVec.x, 0.0f, inputVec.z});
|
||||
Translate(newTransform, globalInput);
|
||||
newTransform.Position.y = 3.0f;
|
||||
|
||||
if (IsOnGround(*this, newTransform.Position))
|
||||
{
|
||||
player.PlayerCamTransform = newTransform;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto newTransform = player.PlayerCamTransform;
|
||||
Translate(newTransform, {globalInput.x, 0.0f, 0.0f});
|
||||
newTransform.Position.y = 3.0f;
|
||||
|
||||
if (IsOnGround(*this, newTransform.Position))
|
||||
{
|
||||
player.PlayerCamTransform = newTransform;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto newTransform = player.PlayerCamTransform;
|
||||
Translate(newTransform, {0.0f, 0.0f, globalInput.z});
|
||||
newTransform.Position.y = 3.0f;
|
||||
|
||||
if (IsOnGround(*this, newTransform.Position))
|
||||
{
|
||||
player.PlayerCamTransform = newTransform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.WalkXRot += rotInput.x;
|
||||
player.WalkYRot += rotInput.y;
|
||||
|
||||
Reference in New Issue
Block a user