How to collide actors (and change their direction) without losing speed?
RH
Member Posts: 1,079
I've searched around but not really found anything helpful, so if you can help or point me in the direction of something useful that i might have missed i would be very grateful.
The problem I'm having is that when the ball bounces off the wall it changes direction but slows down. (I am assuming that this has something to do with the fact that velocity is a vector rather than scalar, my basic maths/physics knowledge).
Is there a way that the ball can keep the same speed but change direction when it collides?
Here is a simplified version of what is going on:
Basically, for example, i have actor1 (a wall that never moves), and actor2 (a ball that bounces of the wall).
The ball has 'Change Velocity' action set to Direction:random(0,180) relative to actor and speed 200.
It also has 'Collide' behaviour with the wall.
The wall has RULE: actors revieves event: overlaps or collides: with actor type: ball
Destroy
Spawn actor 'Wall'
This rule is so that it doesn't move (I wasn't sure how else to do it as i'm relatively new to GS).
Thanks for any help
EDIT: I can finally post, i used to not be able to
The problem I'm having is that when the ball bounces off the wall it changes direction but slows down. (I am assuming that this has something to do with the fact that velocity is a vector rather than scalar, my basic maths/physics knowledge).
Is there a way that the ball can keep the same speed but change direction when it collides?
Here is a simplified version of what is going on:
Basically, for example, i have actor1 (a wall that never moves), and actor2 (a ball that bounces of the wall).
The ball has 'Change Velocity' action set to Direction:random(0,180) relative to actor and speed 200.
It also has 'Collide' behaviour with the wall.
The wall has RULE: actors revieves event: overlaps or collides: with actor type: ball
Destroy
Spawn actor 'Wall'
This rule is so that it doesn't move (I wasn't sure how else to do it as i'm relatively new to GS).
Thanks for any help
EDIT: I can finally post, i used to not be able to
Comments
It uses some complex math to get them not to slow down when colliding.
EDIT: wow there is a lot there, i'll take my time looking through it . Thanks!