Download

Trying to create a flying / driving physics for "FZero"-Kinda vehicles

Hello community!

Im pretty new here and i started playing around with the UTE4, because one day i want to create a futuristic racing game like the goold old “FZero”. I loaded up the simple car project demo and just wanted to try to make it 700km/h fast with tweaking the engine-Settings and stuff like that. My problem is, that im overwhelmed with the options availible. Maybe if someone could take my hand and explain to me what happens there, that would be awesome! Maybe i need a complete self-made blueprint too, because “FZero” Racers are a mixture between airplanes and cars?

Very much thanks in advance!

Really no one able to help me? :frowning:

Answers can take time to arrive, and many times not at all.

My advice would be to do it in a new blueprint.
As what to do in the blueprint, no-ones really gonna walk you through it (referring to how to make it yourself not the car project demo), at least not in serious detail, so you’ll have to try to break things down further and implement it yourself. (Or follow a tutorial)

So lets talk about the basic stuff you’re looking for.

The vehicles seem to hover, so my first step would be to figure out how to make something hover, then try to add some movement, then make it so that the player causes the movement, then make a track see how it does. Always tweaking and expanding.

Looking deeper at how to make something hover, well all we really need is for the vehicle to roughly stay at a certain height above the ground, so we gotta do some measurements, is it too close to the ground? More force in the +Z direction (Up). Too high? Lets let gravity handle things.
How could we get such measurements, there’s a thing called a raycast, we use that, get the distance to the ground and then apply the previous logic.

Raycast: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/index.html

I know it’s difficult, heck, I’m not too good myself, but I feel I have a handle on how UE works and how to go about things (game logic and such), sure, they may not be the best, but it works.

I also find it easier, when Googling (I’m assuming you tried) to try and be more specific, like “UE4 how to make object hover”
And to get you started, came across this searching that: https://www.youtube.com/watch?v=5kltaGld6fQ

Hope it at least points you in a better direction.

Some specific advice:

Don’t use gravity at all. Instead, remove gravity entirely, and allow the track to specify a “down direction” using splines, overlaps, traces, or something to that effect. The physics of upside-down hover-cars is all pretty much BS, centripetal force does not work that way, you’ll need to use programming to rotate and force the ship “down” toward the track even if that isn’t along a Z- vector.

Also, DO NOT try to make the ship actually move at 20,000 UU/s (700km/h). Nothing in F-Zero actually moves that fast. Instead, smaller models are used and the whole thing is “scaled down” to fake it. The maximum level size for UE4 (not using level streaming) is about 500k square units, or 5,000 meters across. Moving at 200m/s, you’d span the level bounds in like 20 seconds; hardly enough space to design a proper track! And that’s to say nothing of the potential for collision issues at that speed. Better instead to make the ship move something more reasonable like 70km/h and then build your level geometry to 1/10th scale (so your 20-meter flying jet is only 2 meters across, and you have tiny little trees and rocks and stuff) and then just throw some numbers on the GUI’s odometer that convey speed. To be honest, I’m pretty sure this last is all F-Zero ever did; the odometer took in some set of normal values like 6,000 units/second as velocity and just displayed that as “948MPH” to sort of trick the player into believing the extreme speed. You could easily do this; if you find that the speeds aren’t what you want, just scale the mapping from actual velocity to odom readout, so that the same top speed reads either 700MPH or 900MPH or 2100MPH. The player doesn’t know the difference, it’s not like he has a radar gun.

Also, I wouldn’t make anything ACTUALLY hover. I would use simple capsule collision, and I would have the hovering be done by animating the mesh attached to it. It’s not as though the hovering would ACHIEVE anything, nothing needs to be able to pass under a ship in a racing game like that, don’t chew up cycles doing actual hovering physics when you can use simple character-style capsule movement. To that end, I leave you with a video of my game’s Dashing mechanic, which allows the player to “hover” along the ground using nothing more than the character movement component and the player’s capsule collider (by using simple movement input commands always aimed at actor forward and an input axis which feeds a lerp between the maximum right and left turn speeds at a given rate). My player actually also uses a “flying” movement mode here, with manually-applied “gravity” force and a trace which allows him to cling to walls as long as he’s moving.

This totally-no-vehicle-physics approach is probably going to be a much easier way of getting you to F-Zero style movement than attempting to get actual physics working for a hovering car that can fly upside down along a track and go 700MPH.

Would using actual gravity make things harder overall?
Also, in terms of hovering, would you use the more complicated hovering if say you wanted the track to be open dirt roads with bumps and stuff instead of the perfectly smooth surface of a track? (And if perhaps, you’re going at much slower speeds)

If someone was thinking im mad because i cant wait, then im absolutely sorry! I did not want to appear like this! I really appreciate all your help! :slight_smile: I first thing i think i have to do now is to learn A LOT about blueprints at all. At the first look they seem to be much more complicated than i thought :slight_smile:

For open dirt roads, I would just put the detritus down and tell it to ignore collision. That way the ship travels along a “flat” road (or a slightly bumpy one) and all the little decorative bumps and cracks and rocks can remain decorative. Seems sorta silly to put in collision data for them (and waste all those triangles on it) and then design the ship’s movement specially avoid colliding with them when what you really want is for the ship to just ignore them by floating above. Again, it would be a different story if you could get out of your ship and walk around, since they’d need to collide with the player and stuff, but for a racing game, your only INTERACTING elements are ships and the track/bounds, the rest is just for show.

If you wanted the ship to “bump hover” over them, like to appear as though its altitude changed slightly to avoid collisions, I would still just disable collision and use a downward trace from the ship to look for objects in a special channel (like GroundDetritus or something) and use that to move the ship mesh up and down relative to the capsule. Getting actual hovering physics going will not be an easy or particularly performant task, unless you have a compelling reason to actually NEED it (like vehicles in a game with walking, so that players can pass under them and stuff) I would definitely just fake it.

I guess I still need to learn when it’s best to fake it or simulate it. And crankshaft, don’t get me wrong, I was just saying as I understand that it can be frustrating waiting for an answer. :slight_smile:

Agreed on the hovering. Just do a trace and keep it’s height at a fixed distance off the ground and just add in some extra faked physics for jumps and bumps etc.

If I made a game with hovering like this, and my game had hills, how would I properly keep the vehicle at a certain distance from ground?

You would want to orient your vehicle to whatever angle the object below it is at. I would probably do this with a raycast on the front and 1 on the back and just keep them both at the same distance by applying rotation. You could smooth it out a bit more by also doing a raytrace a few units infront of the vehicle and adjust its angle quicker. Haven’t really tested out but seems doable just need to tweak the math till it works nicely.