This week I worked very hard on getting a general prototype working within Unity. I spent many days trying to create my own physics system. It proved to be difficult as hover physics require both the floating of an object above the ground while also still reacting well to player inputs without sliding aimlessly around.
I eventually got a rough system working which used four raycasts to shoot down from the players position into the ground. An average of the four points was then used and the ship was moved to that location. The ship would also align with the face's normal it had just hit, meaning that it would accurately stay above the ground and rotate with it when going up slopes and loops. However this system is still very rough and finding a balance between accurate positioning without very rigid snapping of the player is an issue I am still dealing with. The raycasts will also sometimes keep firing through the ground when going up a slope, causing the average point to be calculated within the depths of the void and causing the player to be teleported there. Not very ideal.
Something I am more happy with is a bumper system. Using raycast that fire out in four directions from the front of the ship I am able to detect when they collide with an object tagged with a wall tag. It then gently pushes the ship away from the wall allowing the player to keep flying around the track.
Here are the humble beginnings of my project:
Comentários