Actor keeps going through walls - help!
SpaghettiStudios
Member Posts: 18
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?
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
(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))