I am making an artillery game as a learning exercise for Cocos2d-x (3.17.2) and Chipmunk physics engine; a cannon fires a shell over a random triangular mountain based on power and elevation angle.
My problem is that if I fire at high speed my shell will pass through the mountain (or inside mountain then bounce off the back-inside. Amusing but not suitable.
I get that the engine may “miss” a collision for fast moving objects.
I tried limiting the speed, but once speed is low enough that pass-through does not happen, the shell is too slow.
The mountain is made with a 3 point PhysicsBody::createEdgeChain.
The shell with a PhysicsBody::createCircle.
This seems like it would be a fairly common problem. Is there some special (more costly?) physics mode for fast moving objects? Some trick or special handling?
Since I only have one shell at a time, performance is not a huge concern for now.
I was considering using current and last point of shell sprite for each move cycle and do a linear intersection with the two lines of mountain or something, but it seems like there may be a better (already provided?) way.