Detecting which side on a square actor a collision has occured?
Hey guys,
I have a square actor and want to be able to detect which side has been collided with by another actor. i.e. top, bottom, left and right.
I have a solution in mind. Create four new actors and place them on each edge of the square, then setup collision rules for each. However this doesn't feel like the most efficient method.
Thoughts?
Kind regards,
Guardian
I have a square actor and want to be able to detect which side has been collided with by another actor. i.e. top, bottom, left and right.
I have a solution in mind. Create four new actors and place them on each edge of the square, then setup collision rules for each. However this doesn't feel like the most efficient method.
Thoughts?
Kind regards,
Guardian
Comments
I was thinking of making a set of rules that would determine the direction movement of the actor that would collide into a cube.. by making a set of rules that reads out direction...then you can have different outcome on if you hit the square from different direction...that is assuming that the cube top left and right would always be oriented the same way(not rotate)
I don't know if this would be the most efficient method. But it would be a different way than making more actors.
Upon collision , calculate the angle between the 2 actors (with vector to angle)
Then you can use that value to detect the direction ..
45-135 is up
136-225 is left
226-315 is down
the rest (-45 to 45) is right
Roy.