Hi there. I have a simple game where a ball gets knocked around inside a cube and for the most part it seems to be working fine however, once in a while the ball just bounces into nowhere. What can I do to prevent this?
Thanks,
Hi there. I have a simple game where a ball gets knocked around inside a cube and for the most part it seems to be working fine however, once in a while the ball just bounces into nowhere. What can I do to prevent this?
Thanks,
These overlaps are not always a ‘neat’ thing. We think of the ball overlapping when it enters the box ( or whatever ), and then generating an ‘end overlap’ when it leaves the box.
But if you print a log of overlaps you’ll notice the ball can generate BeginOverlap more times than 1 even though it has not left the volume. It can also generate EndOverlap without apparently leaving the volume ( only part of it needs to exit ).
So in some cases we need to code taking this into account.
For instance, I might use overlap events to fire a timeline ( one way or the other ), if I code it assuming a ‘neat’ world, often it will work but not always. When the more messy world starts to appear, I have to be able to run the time line forwards or backwards, at the drop of a hat. It may only run backwards to 5 frames and not be noticable, but my code copes with the ephemeral nature of the events.
Update: Workaround. I used a branch node with event tick to see if the ball becomes out of bounds and if so places it back in the level. Thanks guys!