Bug in actor physics?
I'm putting together a very basic paddle game, and have been having a weird issue with my actors' bounciness and velocity when they collide or are reset to their original position. I have a ball actor, a paddle actor, wall and ceiling actors for the ball to bounce off of and a floor actor below the paddle that resets the position of the ball whenever the ball actor touches it.
The vast majority of the time, this seems to work all well and good, but on random, rare occasions, when the ball is reset back to its original position, it will fall a lot more slowly than normal and then come to a rest on the paddle instead of bouncing off. This will also occur every now and again when the ball hits a wall or the ceiling.
I am at a loss as to why this is occurring, as my code doesn't change the physics properties of any of these actors at all. Could anyone provide any insight into why this is occurring?
Here is a summary of the code that governs the ball's behavior:
Accelerate: Direction 270, Acceleration 250, Relative to Scene
Change Attribute: StartX = self.Position.X
Change Attribute: StartY = self.Position.Y
Collide: Bounce when colliding with Wall
Collide: Bounce when colliding with Ceiling
Collide: Bounce when colliding with Paddle
Rule: On collision with Floor....
Change Attribute: self.Position.X = StartX
Change Attribute: self.Position.Y = StartY
Change Attribute: self.Motion.LinearVelocity.X = 0
Change Attribute: self.Motion.LinearVelocity.Y = 0
Here are the initial motion and physics values for each of the actors. These values are not changed at all during the game:
Ball:
self.Motion.LinearVelocity.X = 0
self.Motion.LinearVelocity.Y = 0
Density: 50
Friction: 0
Bounciness: 1
Drag: 0
Paddle:
Density: 100
Friction: 0
Bounciness: 2
Drag: 0
Walls and Ceiling:
Density: 1000
Friction: 0
Bounciness: 1
Drag: 0
Any ideas on why everything seems to work about 95% of the time, but during the other 5% the ball randomly decelerates and doesn't bounce after being reset or colliding with one of the other actors? Thanks!
The vast majority of the time, this seems to work all well and good, but on random, rare occasions, when the ball is reset back to its original position, it will fall a lot more slowly than normal and then come to a rest on the paddle instead of bouncing off. This will also occur every now and again when the ball hits a wall or the ceiling.
I am at a loss as to why this is occurring, as my code doesn't change the physics properties of any of these actors at all. Could anyone provide any insight into why this is occurring?
Here is a summary of the code that governs the ball's behavior:
Accelerate: Direction 270, Acceleration 250, Relative to Scene
Change Attribute: StartX = self.Position.X
Change Attribute: StartY = self.Position.Y
Collide: Bounce when colliding with Wall
Collide: Bounce when colliding with Ceiling
Collide: Bounce when colliding with Paddle
Rule: On collision with Floor....
Change Attribute: self.Position.X = StartX
Change Attribute: self.Position.Y = StartY
Change Attribute: self.Motion.LinearVelocity.X = 0
Change Attribute: self.Motion.LinearVelocity.Y = 0
Here are the initial motion and physics values for each of the actors. These values are not changed at all during the game:
Ball:
self.Motion.LinearVelocity.X = 0
self.Motion.LinearVelocity.Y = 0
Density: 50
Friction: 0
Bounciness: 1
Drag: 0
Paddle:
Density: 100
Friction: 0
Bounciness: 2
Drag: 0
Walls and Ceiling:
Density: 1000
Friction: 0
Bounciness: 1
Drag: 0
Any ideas on why everything seems to work about 95% of the time, but during the other 5% the ball randomly decelerates and doesn't bounce after being reset or colliding with one of the other actors? Thanks!