Actor keeps going through walls - help!

SpaghettiStudiosSpaghettiStudios Member Posts: 18
edited November -1 in Working with GS (Mac)
I'm finding that the collision detection has a problem.

I have a constantly moving ball. When it hits a wall it is supposed to change direction. It does this most of the time. But there are times when it goes straight through them, especially when it is moving up and down or at a diagonal. Left and right tends to be fine.

How do I ensure that whenever the ball hits a wall, no matter which direction - up, down, left, right, diagonal - that it never goes through?

Comments

  • Ruslan21Ruslan21 Member Posts: 228
    in you wall actor in physics uncheck movable. that should take care
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Either that or, are you using constrain for your actors movement? That will override collision and you'll find things running through each other. If you just need your actor to stay withing a set of 4 walls, build the min/max X/Y into your constrain logic. Example:
    (for landscape)

    Constrain: self. position.x to min(480,max(0,game.mouse.position.x))
    Constrain: self. position.y to min(320,max(0,game.mouse.position.y))
Sign In or Register to comment.