Rotating player 90 degrees after hitting the wall.

Hello, guys! Here’s the thing… I want my pawn to reflect the wall after hitting without using any physics. My pawn’s turn step is 45 degrees, so it hits the wall under 45/-45 or 90/-90 degrees. After hitting I want it to reflect under the right angle, or die if it hits under 90 degrees. I managed to do that (blueprint picture below) and it worked well until I add OnComponentHit event for second wall. After that pawn started to do weird things, like turning by 180 degrees after hitting and not die! Please help

Remmber control rotation is the view of a pawn. You may want to use GetForwardVector instead to always get the +x vector.

I’m a litt econfused as to what your exactly trying to do your wording is a little hard to understand but I think replacing get control rotation with GetForwardVector * float(100) should get better results.

Also OnComponentHit will only work on actors with physics enabled. So you may want to do a trace instead.

Hope this helps
Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

Thanks for answering. I apologize for my English. It’s not my native language. And physics component is enabled, yes, but I try to calculate the pawn’s ricochet mathematically, because of clear integer angles. I’ve tried your way (GetForwardVector), but the same result came. Now I’ve discovered that my pawn’s angle during the straight hit is not clear 90 degrees, but 90.00008 etc.

Hello kidnaped,

I am marking this thread as resolved, as we have not heard from you in a few days. If you have any further questions regarding this topic, feel free to reply to this thread. Any new questions should be posted in a new AnswerHub topic.

Thanks, and have a great day,

Sean Flint

Hey I’m getting a similar problem, did you even figure out what the deal was? I’m getting 90.000008 exactly when I rotate my pawn 90 degrees with a timeline.

Hello RyanSergent,

Could you try using a floor node on your float to create an integer? This will remove the extraneous decimal places that you having an issue with. I hope that this information helps.



Make it a great day