Download

Making actor parallel to ground

Hey guys!

I currently am trying to get my character floating on a magic carpet, which will react with the environment by hovering parallel to the ground.
I have Almost achieved this!

Screenshot_59.png

Rotated one way in world:
Screenshot_60.png

Rotated opposite way:
Screenshot_61.png

Basically, I have a line trace directly under the player. It then gets the impact point, tries to turn it relative to the actor, turns it into a rot, and sets the target rotation value. (My own variable, doesn’t matter)

It works, except turning it relative. As you can see, he rotates for sure, but the way he’s turning doesn’t change depending on where he himself is rotated. :frowning:

This is the part that needs fixing: Making the impact normal relative to the player’s rotation.
Screenshot_62.png

Any ideas for this? I’ve tried getting the actor rotation, as well as control rotation. None of them work :c

Thanks!

You need 3 line traces, hit points will make a plane (and triangle). Out of that 3 points make 2 vectors starting from same point.
Then do CROSS product of those vectors, and you will get normal vector to area that is below carpet.
Then calculate DOT product of Up vector for carpet and result from above line (cross product)

result of DOT product is cosinus of angle between carpet UP vector and normal vector to plane below carpet.

You can always find rotation for from UP vector of carpet to cross product (which is vector) result.

So look in palette menu (you may ad it to visible menus) for anything that has “find rotation” in name.

Here is a way to do it
test210.PNG

Sorry about the very slow reply!

Yes! This worked perfectly! Thanks a bunch! :smiley: