• Register
Post news Report RSS DevBlog 4 - Stretching Projectiles Between Frames

Frame hitches can cause bugs where projectiles pass through walls, how I solved that in my custom from scratch engine.

Posted by on

With editor ui and a level system integrated, I can visualize my idea for stretching projectiles.
It roughly works like this: The projectile end points are determined based on delta time, and the distance between them.
The model is offset and scaled so that we can use one tip of the projectile as something like a pivot point The model is first scaled in local space (eg along z axis) by the distance between the two points.
Then the model is rotated so that it is moving in the correct direction of the projectile. After rotation, the model is translated to the correct location.
Now the projectile is essentially occupying the space between the last frame's position and the current frame's position.
I skipped a bit of steps to be conversational, SAProjectileSystem.cpp `Projectile::stretchToDistance ` defines actual stretching implementation.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: