• News

• Industries

• Learning & Support

• Community

• Marketplace

# Simulate Flight time for bullet

Hello guys,
I using traces for simulate bullet drop, It’s a loop that every time add a little drop to bullet based on initial speed. But i want to add a flight time to that based on speed and distance, I can get flight time by get distance from start fire and hit location and divide to speed. and it’s working for single shot when i add a delay based on flight time but it’s not working for auto and continuous firing. please help me to solve this problem

Any reason why you don’t want to place logic into the bullet itself? It really straightforward to just modify its position and velocity on tick. For extra precision you could either raytrace from current position to next position (using average delta time and speed) or simulate it as physics body and enable CCD

You mean i spawn an actor for every bullet?
I don’t want to use projectile, i want to use single traces.

Then you can add an array where you track when each bullet was shot and track time from there.

EventTick on a scene component with a point vector that adjusts position along forwardVector by += (deltaTime*currForwardVelocity)dragCoefficient and drops at z -= (9.8deltaTime)*currDropVelocity

Or just use math that computes the entire bullet arc on eventFireWeapon. Its a simple parabolic equation.

You can move all those calculations (instead in array) into bullets.
When you aim and shoot, spawn Bullet bluaprint at trace line end, tell that bullet what was distance from muzzle to line trace impact, and its speed.
Then do all your calculations inside that bullet plueprint.

So basically move your calculations for single shoot, into some bluerpint that you always spawn at hit location. After time is up make sure to destroy those “virtual” bullets, so they do not clutter game.

Thanks guys, I working on it to get best results