How to collide actors (and change their direction) without losing speed?

RHRH Member Posts: 1,079
edited November -1 in Working with GS (Mac)
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 :/

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Check out my magnitude demo under my profile. It has three balls bouncing around off each other and the walls.

    It uses some complex math to get them not to slow down when colliding.
  • RHRH Member Posts: 1,079
    thanks, i'll take a look now and edit this post if i have any success!

    EDIT: wow there is a lot there, i'll take my time looking through it . Thanks!
Sign In or Register to comment.