CGT Week 4: Implementing Mechanics Part 1
- dylanknipe456
- Apr 26, 2021
- 3 min read
Updated: May 8, 2021
15/03/21
This week I was determined to get half of my mechanics implemented and leave the second half to the following week. Below is every mechanic I successfully implemented.
Torch


Implementing the torch was reasonably straightforward. I found a wall-mounted torch mesh that I edited to remove the wall-mounted part. I ended up with the torch you see in the picture. Then I added a particle flame effect to the top of the torch with a point light that gives off a faint orange glow wherever it is pointed. I made sure to pick a particle effect and light source that is not too bright or disorienting, since the torch will almost always be carried and will be next to the face of the players for most of the time. I then lined up the torch with Unreal Engine's basic VR hand template, so when the torch is grabbed, it snaps to an appropriate position automatically. This was done to make picking up objects less finicky, as initially I spent a lot of time at the start having to grab the tip of the torch and gradually get myself to a comfortable position. This piece of code was applied to all the mechanics that the players will spend a lot of time holding, such as the gun and the shield. The players pick up any of these items by simply pressing and holding the side button on each appropriate hand.
Curtain

After setting the torch up, I decided to move onto the curtain. Nothing too exciting here, as it was just a matter of the torch being overlaid on top of the curtain so that it burns away after a few seconds. When the flame of the torch is within the collision box of the curtain, a flame particle effect appears and after a few seconds, the curtain is destroyed, allowing the players to continue on their path.
Breakable Floor

Whenever the players step onto a breakable floor, similarly to the curtain, a particle effect of a small dust explosion appears, with the floor itself being destroyed. The players will then fall into the area below the floor.
Chest

Whenever the players are within close enough distance of a chest, it automatically opens for them, with gold then being added to their inventory. I decided to have the chest open automatically rather than the players having to physically do it themselves as they could potentially have both hands full with either the torch, shield or gun when approaching one. This should alleviate multitasking and will just make the overall experience more streamlined. The important factor is the placements of the chests, rather than the contents that are inside.
Gun and Gun Platform


Similarly to the torch mesh, I scoured the Epic Games Store for an appropriate gun mesh. Once located, I added an arrow component to the tip of the gun to indicate from where the bullet would fire. I then created the bullet actor, which is just a simple sphere. I then created the shooting input, which is simply executed whenever the players are holding the gun and pressing the trigger button. To help ease with performance, I made the bullets disappear after a few seconds and limited the number of times the players can fire the gun before having to wait a while to fire again. Onto the gun platform, whenever the bullet makes contact, it falls to the appropriate location on the map. I made sure the platform was wide enough to comfortably walk on, but still nerve-wrecking enough that the players will take their time crossing it, as the placement of these platforms is exclusively over bottomless pits.
Comments