Help to find Z and the Terrain...

Hello friends, I trying to fly here but I got a problem when going vertically up and get some wrong ground distance. I have illustrated bellow my drama! rs Could u guys help me?

How can I Anways know the terrain direction or anways know Z direction…

If I understood correctly, you are somehow calculating through the actor’s relative rotation.

Try getting the values from world rotation.

Hey Gbr, thanks for answering. In fact, I m using a “line trace by channel” from the bottom of the plane(componentscene[begintrace]) pointing down with another(componentscene[endtrace]) to find the terrain and calculate the distance from that… But its always point between this two point so if the plane go vertically I lost the precision…

Could u help me?

Thank !
MG

Try these:

I would suggest you to use this logic:

This 50k value can turn into a variable which you can control your ground scan limit.

I’m not sure if, by rotating your actor when moving, it would fall into the same problem as before using the IronicParadox’s solution, but it’s worth trying.

Thank u Ironic but I m using a Pawn without character movement component… :slight_smile:

I will try these :slight_smile: let’s see what gonna happens…!

1 Like

Works perfect! always maintain the Z direction! Thank Guys!

1 Like

Ahh, if you’re not using a character movement, then yeah, you’ll have to line trace by hand. His example will work just fine for it. You can break the hit result and get the length from there by taking the hit location and subtracting the actor location, then get vector length. That will give you exactly what you need.

Oh and one more solution to a potential problem that you might have is if you want to get distance from the nose or the tail, to the ground. In that case, you could add a dud component to your blueprint and position it to where you need it to be and then use that as a reference for things when you need coordinates to it. So instead of getting actor location in that line trace, you could drag in the component, from there, drag off and get location, then use that vector instead.

1 Like

Hey, my friends. Another quick help… my counter always get to 0 zero again after 9999… Could u guys solve that?

http://jungleclientes.com.br/clientes/3123321.png

Sounds like an error with multiplication/division somewhere. Check your line trace range maximum. Like in the node with the +50000 in it, make it large enough that no matter how high you are, it will still reach the ground. If it doesn’t reach the ground, it might be returning null, which if you are multiplying or dividing with, it will likely give you zero or some weird number. I don’t know exactly how you have your range thing set up though.

I agree with Ironic, try increasing the 50k number to some huge amount and see if this problem persists.

Still going to 0 after 9999… even with a million point on the trace lenght… No success …

Yeah it sounds like some kind of issue with the rest of your code then. Are you converting the length float from the distance check to another kind of unit? It sounds like something is getting clamped. Maybe the UI text doesn’t have enough room for another digit? I’d check the UI elements and blueprints.

Kind silly but was just this the text format :slight_smile: Ty man!