Hallo everyone! in this post I’m going to talk about the gameplay in Sound of Life and what we need to make it work. I’m also going to talk a bit about widgets in Unreal Engine 4 and how we are planing to use them.
Lets start by explaining our gameplay. You play as a rescue worker and your job is to place sensors to try to locate people that are trapped underground. So the First thing I had to was to make the player be able to place sensors. I did this by activating an reycast at button press and the spawn an sensor actor on the point of collision if it collides. An impotent thing to think about when you spawn actors whit a static mesh component is to know where the objects pivot point is located. The actor will spawn at it’s pivot point so if it is in the center you will have half of what you asked for. After that is done you have to change it rotation so rotated in the right way, and with that I mean not always straight up.
So now when we know that the actor will spawn in the right place we have to make sure that the player know whats happening. this is done by spawning a ghost with the same mesh as the sensor so that the player can see where the sensor is going to be spawn. I also made two new materials, one green that is placed on the ghost when a sensor can be placed and one red material for the opposite. This makes the placement of sensors easier to understand.
But it is not enough just placing sensors, you want to be able to pick them up as well. So I added function that destroys a sensor if you look at it and press an button. It worked fine but now the game needed a way tell the player what he/she was looking at. The solution for this was to add an outline when the player was hovering over the object. The problem with this was that it was hard to see so instead we added a material that lerpt a colors transparency so it looked like blinking.
Now when you can see if you are looking at a sensor it would be nice to see where you are looking. So I added an crosshair in the center of the screen and after that I added an animation that will play when you look at an sensor. The crosshair is made in a widget and the widget is called on when you are hovering over the sensors. It is made out of four images that just changes location depending on which animation is playing. Creating an widget is one way of creating a HUD in unreal. This dose not work that good because it is animations so it finish one animation before starting the other. So this will be changed to work similarity to our crouch function in an later date.