Calculate floor angle using single line trace

This may be a silly question. I’m working on a Hover Vehicle Project and I want to calculate the floor angle using a single line trace for vehicle’s pitch, yaw etc. like this.

I’m really bad at Vectors so,

  1. If I add Down Vector and Impact Normal together, do I get the vector parallel to the floor?
  2. How do I use [1] to make a rotator with vehicle’s forward vector to calculate the slope angle and bank angle?
  3. If [2] is a stupid way to do this, or if you have a better idea on how to calculate this, explain.

Thanks if you read this so far.

  1. Yes that should give the correct vector. One parallel to the floor. I’d normalize this for safety.
  2. You can use a Find look at rotation node using the vector from part 1 as the target and a zero vector as the start, that should give you a rotator for the floor. You can grab the pitch and roll from that and do some calculations on it to convert it to get your pitch and roll (slope and bank) angles.
  3. Your way is not stupid just not how I would approach this. If you instead traced from the four corners of your vehicle you could get some more information you might want later as well as some slightly simpler to understand math.

Using the hit locations of both the left sides you can make a vector (Back - Front) then using the vector from the start locations (Back - Front again) you can do some lovely trig to get the angle difference. You can do the same on the right side and average it for a more accurate result. Using the same method but going left to right will give you the bank angle you need.

1 Like