• Register
Post news 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
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.