Angles
Okay so i was wondering how you work out what angle one actor hits another at. Because i want to have it so that when one actor hits another the other bounces off in the angle they hit. At the moment the actors just hit one another and both stop. I have restitution on.
Thanks
Thanks

Comments
Just check what the rotation is when the actors hit each other, here's a very quick example . . .
http://www.mediafire.com/?aiyb3ec5u6z22bu
If it helps the actors are both on circular collision.
Make an angle attribute called collisionAngle
Make 2 real attribute, and call them grabbedactorX and grabbedActorY
Make a boolean self attribute in the actor you want to move when hit called moveOn
In the actor you move with the mouse,
constrain attribute grabbedActorX to self.position.x
and constrain grabbedActorY to self.position.y
If you havent already, to make it move with the mouse when touched have this rule:
When touch is pressed
-constrain self position.x to mouse.position.x
-constrain self.position.y to mouse.position.y
Now put these rules in the actor you want to move when hit:
A rule when actor overlaps or collides with( actor that moves with the mouse)
-change attribute collisionAngle to vectorToAngle(self.position.x-grabbedActorX,self.position.y-grabbedActorY)
-change attribute moveOn to true
the one more rule when attribute moveOn is true
-the have change velocity behavior, have it set relative to scene, have the speed whatever you want, and for the direction set it to the collisionAngle attribute