Week 7 Development

Fixing Collisions

On Wednesday I continued working on the game, and noticed that the rat was registering as grounded every so often when holding the screw, interrupting the jump animation and allowing the player to jump in mid-air.

This was rectified by adding a layer mask corresponding to all solid static surfaces (denoted as “Walls”) to the ground check in the player movement script:

I also saw that a similar problem was causing problems with camera collisions when holding the screw, so I moved the layer check from inside the existing sphere cast:

To inside the cast itself:

This was more elegant and fixed the camera problem.

This also required me to double check and ensure all the static objects were given the Walls layer, which is tedious but ultimately worth it.

I wanted to work on something fun so I decided to implement tooltip popups above grabbable objects. I started by creating a Canvas in world space for a popup. This had to be scaled down to fit in the scene.

Then I added my existing script I used for the advance dialogue prompt, that replaces the button prompts with sprites.

These now need to be given code to face the camera. I used code from this video by Christina Makes Games:

I then added this to a Billboard script component of the popup canvas object. Now the popups properly face the camera.

Leave a Reply

Your email address will not be published. Required fields are marked *