Week 2: New Hoverbike movement behavior and replicating the mount icon visibility
Hello again! Ram here with another development log of the Hoverbike.
Before fixing the movement of the hoverbike while replicating, first I decided to revamp the hoverbike blueprint. One of the few things that bothered me the most was that the hoverbike was using a character blueprint as base instead of a pawn blueprint. This limited the movement behavior that the hoverbike could achieve. Although this approach meant that the gravity would have to be simulated it gave better results than the previous one.
Now you can ride the walls! I need to tweak some values to achieve the movement I'm looking for but at the moment it is very pleasant to use the hoverbike.
This revamp took most of the time I dedicate to this project but I wanted to do some networking stuff before posting this article so I fixed the mount icon visibility. This icon shows up every time you are near the bike to notify you that you are able to ride bike. In single player this worked flawlessly but with multiplayer I discovered that the icon was popping up for everybody. In the video below you can see the bug.
It took some trial and error to run something only in the desired client but I manage to do it by changing these nodes.
In the images above you can see the function that sets the icon visibility (in the previous version I used visibility and in the new one I used Hidden in Game but it shouldn't make any difference during replication). This function is executed when an character overlaps the hoverbike ride collision and tells the bike that someone is near to ride it.
To make it work, I just needed the character reference that triggered this function and compare it with the player pawn. The get player pawn node will return the local pawn and will only be equal to the character reference if the hoverbike version is the local one.
And now this is the status of the hoverbike
In the next development log I will show how I fixed the replicated movement of the hoverbike. See you soon!