Collisions and bouncing...

DrGlickertDrGlickert Member Posts: 1,135
edited November -1 in Working with GS (Mac)
I have a brick breaker type game that I'm making.

I have a rule on the balls that If Ball collides/overlaps with actor: Side Wall;
Change attribute self.linear velocity.X to -self.linear velocity.X
(this gives it a true bounce from which the ball was coming from).

I have the collide behavior on the side wall.

Sometimes (actually, much more often then I'd like) the ball "hic-ups" on the wall. Like it tries to bounce off but doesn't completely and takes a fraction of a second to bounce off correctly.

1. Does it matter where the collide behavior is at? Should it be on the ball instead? Should it be on the ball AS WELL?

Anyone else ever had this problem and what'd you do to fix it?

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    try raising the density on them. Also you could try putting the collide behavior in both actors and see if that helps.
  • DrGlickertDrGlickert Member Posts: 1,135
    The density of the ball is 1.
    The density of the walls are 5000.

    :-)

    I'll try collide behaviors on both actors. Do you know how much processing power is required for collide behaviors? I'm really needing to cut some serious stuff if I want this game to be playable.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yeah that density is super low
    try raising it to like 50000 on the walls

    and raise the ball to like 100 if u can
  • scribblstudiosscribblstudios Member Posts: 118
    Or try just using the built in physics, check the fixed rotation box, and set the restitution on both objects to 1.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    scribblstudios said:
    Or try just using the built in physics, check the fixed rotation box, and set the restitution on both objects to 1.

    the density is the built in physics. His problem isnt the amount of bounce (which would be restitution) its that the object passes in for a sec before the collision is detected. Hence adding density to the walls
  • mangaroomangaroo Member Posts: 419
    nice solutions (collide on both and tweaking density) i wish there was a guide for the values in those boxes..would never have guessed 50 000! thanks for the info John

    about putting collide on both - im guessing thats to do with how often it checks all the rules and it being more likely that it will come across the rule during that time period if its on both actors... anyone know what the time period is - 0.05 or 0.01? or less?
Sign In or Register to comment.