stargazing-dino / cosmic-junkyard

A space game
MIT License
1 stars 0 forks source link

Turning and Orientation #36

Open stargazing-dino opened 1 year ago

stargazing-dino commented 1 year ago

Overview:

For our game, with its dynamic gravitational fields and gameplay reminiscent of "Mario Galaxy", we need to ensure that the player's character not only responds well to input in terms of movement but also in terms of turning and orientation. As the player moves across different surfaces and gravity fields, the character's orientation should align with the gravitational pull of that area. Additionally, the character should turn smoothly to face the direction of movement, adding to the game's fluidity and visual appeal.

Goals:

  1. The character's feet should always appear to "stick" to the surface they're on, regardless of the gravitational direction.
  2. The character should turn smoothly, without any sudden "snaps", when changing movement direction.
  3. As an added polish, the character should tilt slightly in the direction of movement for a more dynamic feel.

Tasks:

  1. Gravity-Aligned Orientation:

    • Determine the gravitational direction for the current zone or surface the character is on.
    • Gradually lerp or rotate the character's orientation so that their 'down' aligns with the gravitational pull.
    • Ensure this works when transitioning between different gravitational zones.
  2. Smooth Turning:

    • Implement a rotation function that takes into account the character's current facing direction and the desired direction based on player input.
    • Instead of instantly switching to the new direction, smoothly interpolate between the current and desired directions over a short duration.
    • Ensure that turning speed is consistent, regardless of frame rate.
  3. Dynamic Character Tilt:

    • Based on the movement direction and speed, tilt the character model slightly in the direction they are moving.
    • This tilt should be subtle and return to a neutral position when the player stops moving or changes direction.
    • Ensure the tilt direction takes into account the local gravitational direction and not just the global "up" and "down".

Testing:

  1. Move the character across different surfaces and gravity fields. The character's orientation should always align correctly.
  2. Change movement directions frequently and observe the character's turning behavior. There should be no sudden snaps, and rotations should feel smooth.
  3. Observe the character while moving at different speeds, and from different camera angles, to ensure the tilt looks natural.

Notes: