How to make an actor bounce off walls?
Hello GS community!
I have a scene (portrait) with 2 walls on either side. I want an actor to spawn from the top of the screen (just outside viewable area) and come in at an angle, where it will bounce off one wall,then the other, and so on, till it reaches the bottom of the screen,all the while maintaining the original angle of entry. If I create 2 rules in the actor Change attribute - self.motion.linear velocity x to AAA
and Change attribute - self.motion.linear velocity y to AAA
, then this will work. However, that means that for a smaller entry angle, the actor will move slowly, and if i increase the value of AAA then it will go faster but within 2 bounces the actor has gone off the bottom of the screen. IF i make the values of the rules different, each time the actor bounces, the angle seems to get smaller and smaller until it no longer moves downward but merely bounces from side to side.
So, how do I control the angle and the speed of the actor? ( I want to be able to spawn the actor many times, each time with a different angle and speed for unpredictability, nuff said)
Any help is appreciated!! If you dont understand what I am trying to ask please tell me which part is confusing!
Comments
Turn the friction for both the spawned actor and the walls to 0.