Hello!
I am playing around in UE4 and right not I am trying to create a simple snowboard game but I am currently having some problems.
I would like to play a animation of my character crashing if the angle between the velocity vector and the direction that my character is facing is bigger than 30 degrees. I attached my failing solution below along with a explanation of my problem (the variable “Camera Direction” should be named “Character velocity”).
Your code is checking for greater than 45 degrees, not 30 like you are asking about.
What problem are you experiencing? Did you set a break point at the compare?
Basically, you need to break it down and determine where the problem is. Is it in calculating when to play the animation, or is it in playing the animation?
Sorry about the degree value, I changed it to 45 so it would be easier to determine if the math were correct.
Right not it is playing the animation but it is not consistant about when to play it. It plays it even tho the angle is less than 45 and it always plays the animation if the velocity is zero regardless of the characters direction which is strange since the dot product of a zero vector should be zero.
I have tried to “draw debug line” of the characters direction vector and found out that the problem lies there. So I need a way to get the vector pointing in the direction that my character is facing (in the xy-plane).