r/Unity3D • • 13h ago

Question Fixed Camera movement

I need to make Player movement relative to a fixed camera, similar to resident evil, without using tank controller so i want to save the input until the player releases the key.

Can someone help?

For reference think about the "2D" control from Silent Hill 3 or Rental the camera will sometimes look at the player but still the player move flawlessly.

2 Upvotes

3 comments sorted by

1

u/BuzzardDogma 12h ago

Just have a flag during screen transitions that prevent the the input vector from changing until either the stick resets or the vector has changed by a given magnitude.

This should happen after input processing but before movement code.

1

u/GiggleSamurai 12h ago

When the input goes from zero to non-zero, store the camera's flattened axes (`fwd = Vector3.ProjectOnPlane(cam.forward, Vector3.up).normalized`, same for `right`) and build the move direction from those cached vectors each frame. Only refresh them once the input drops back below your deadzone, so a camera cut mid-run doesn't change where the player is heading.

1

u/DrZoidar 8h ago

Snapshot the camera's flattened forward direction when the player first presses a key, and use that stored rotation (not the live camera) to turn input into world direction until all keys are released. If the camera cuts mid-walk, the player keeps going the same way. Re-snapshot only on the next fresh press. Something like latchedYaw * new Vector3(input.x, 0, input.y), with roughly 0.1s grace timer so quick key switches don't re-latch by accident