I have 2 problems handling collision and physics gravity.
The first one is that gravity isn’t often applied up to down. I didn’t arrange the level settings and I confirmed the actor isn’t placed upside down.
This is a short image of the actor, gravity not applied properly(The actor is that tiny ball). Eventually I couldn’t catch up the speed and the actor goes away to the sky. ‘ALT’ in the right side is the player’s altitude, so no doubt that the actor is actually having gravity upwards.
This is what I expected. The actor bounces off as it collides with the floor.
The second problem occurs here. The actor sometimes doesn’t collide with the floor and passes through it.
The actor’s collision and the landscape’s collision is set to both block each other. Nothing has been changed in the initial settings but the result is changing randomly.
I have no idea why collision doesn’t work the same every time, why gravity is applied upside down.
The ground collision miss is probably due to the speed of the object.
During the next frame the plane has passed through the collision mesh, causing it to clip passed it.
You could probably do a raycast check in front of the plane depending on it’s speed / acceleration the distance would need to be different. Cast ahead and see if within the next frame the plane would hit the mesh if so in the next frame get the cached collision location and probably project the planes position back to the hit point (probably with teleport set to true).
Yeah the speed is too fast. Only way to handle it would maybe be physics sub stepping or the raycast method.
As for the altitude how are you measuring it?
Is it from a set sea level (could be a ref actor or global variable) and checking your z location compared to the location of the sea level?
Altitude is currently just defined as (Player’s Z axis position ÷ some constant number). There is no reference to get the altitude value, only the GetActorLocation(self)'s Z value.
How are you applying the gravity? Are you using the default floating movement for flying objects or are you calculating it manually (I’m guessing you might be calculating some sort of lift force based on flap position and speed) The lift force would have to overcome the force of gravity for the plane not to fall.
This is my first attempt to actually use gravity. I was trying to find how to use gravity looking good, but soon I just moved to other things since gravity usage wasn’t that frequent. Currently I just added a few nodes decreasing the Z axis position to replace gravity. So acceleration and gravity are both using “AddActor(Local/World)Offset”. For now I am trying to use physics gravity only when an actor loses all health and lose control. It would be great if I can combine this gravity and “AddActorOffset” to look more natural.