I'm trying to do the same thing this guy wants to do:
Here's what I want to do.
I don't understand which Vector2 actions i should use to:
1) get direction from arrow.
2) during collision, reflect on the normal vector of the barrier.
3) give arrow new direction.
http://hutonggames.com/playmakerforum/index.php?topic=5992.msg29092#msg29092However, the proposed script doesn't work exactly right. The arrow does bounce off of the walls in the proper direction, but the arrow does not then turn to face the direction of reflection as specified in the drawing. Instead it kinda spins around according to the physics simulation.
What I would like to do is set the velocity (with the set velocity 2d action) of the arrow for the approach, detect the collision with the wall, and then calculate the reflection direction based on the surface normal of the wall. The problem is I can't figure out how to get the wall's surface normal. Using raycast checks and collision checks, all I can find is the normal of the
collision point -- and since the arrow faces the collision point directly, the collision normal just points right back at the arrow.
So, does anybody know how I can find the actual
surface normal, in world space, of the wall the arrow collides with? Or perhaps an alternative method to accomplish the same goal?
Thanks for any assistance.