Player controls, movement and interactions


Player controls

We set up player movement with the unity input manager as a base, this can allow us to easily implement controls that are usable across different control schemes, such as keyboard and mouse or game-pad. While our primary release target is OpenGL on PC, controls were done in this way to make an easy alternative option for players that may wish to use a game-pad as their control scheme of choice. The controls as this point in time are:

- Movement - WASD / Left Joy-Stick

- Camera - Mouse / Right Joy-Stick

- Sprint - Left Shift / Left Trigger Button

- Jump - Spacebar / South Game-pad Button

- Punch - Left Click / West Game-pad Button

- Grab - Right Click / East Game-pad Button

Camera controls

The camera controls used is a third person control with mouse look. This allows the camera to move not only with the user's movement inputs but also with their mouse, allowing them to see all around rather than just what the player is facing. This is important since some of the levels will require the player to take note of their surroundings in order to complete the puzzles. The camera used is a Cinemachine camera targeting the player object in unity with the 3rd person follow settings.

Camera movement. Note that our player model prototype is currently just a little among us character, mainly so we can tell where the front of the model is, but also for fun :)

Movement 

Movement has been adapted from the Unity Starter Assets for PlayerMovement, with the primary change being that movement is applied to the player characters rigidbody, allowing for movement to be tied to a physics system that is essential for the gameplay being tied to a boulder that is attached to the player with a chain and capable of pulling the player around with its weight. The chain too acts as an anchor to stop the player from moving too far away from the boulder easily.

The boulder limiting the player's radius

Punching and Lifting mechanics were made by extending the use of the unity input manager, adding in new commands for the left and right click on the mouse, keeping all mechanics using the same underlying system. The way in which they work is very similar, with each creating a cube to shoot out in front of the player a small distance. This cube is the hitbox for the abilities, and is sent out to check for any applicable objects that can be interacted with (in this case the boulder, however the types of objects can be increased in the future).

The (invisible) cube used as the punch

Punch in action

Note that in game the cubes are non-visible as from the players point of view the character animations will display that they are performing these actions. The main difference between the punch and the lift is that while the punch cube has a physical presence, allowing it to push objects it comes in contact with, the lift has no such presence, instead tagging the object that it passes through as an object to be lifted up by the player, sending a command to the player to pick up the tagged object (usually the boulder), and changing the right click functionality to instead be placing the held object back on the ground, as seen below.

Boulder lift and drop

Ignore the placeholder model :) 

Comments

Log in with itch.io to leave a comment.

Good! Phisics is a special theme. It is hard to set it right! Looks your phisics works well!