# Dropping a not guided bomb

This topic is 1408 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi there i am trying to make a bomb indicator that shows where the bomb will fall.

sth like this: (sorry for lowres pic)

so when i drop a bomb it has some velocity from the beggining, the drag and gravity starts to act (sam efor the lift but i don't mind with it for now)

but before i show you my solution i want you to read the main movement code:

t3dpoint WeightForce 	= Normalize(-pos) * Q;
t3dpoint DragForce 		= Normalize(-vel) * (DragCoeff * ((1.250 * squareSpeed)/2.0f) * 0.760f);
t3dpoint Acceleration 	= (WeightForce + DragForce) / Weight;

pos = pos + (vel * dt);
vel = vel + (Acceleration * dt); //where dt is time between frames


so i thought i should make a fast iteration to the surface -

 while (bomb_didint_hit_the_surface)
{
set dt to 1 second
calculate all forces
calculate new position
make a ray from now position to new position and check if i hit the surface with this ray then i return;
}

it would look like this (every red line is one second interval i hope you get the point

Is there any easier way to determine the falling point?

##### Share on other sites

I thought that (in the real world), non-guided bombs fall straight down. :)

##### Share on other sites

I thought that (in the real world), non-guided bombs fall straight down.

They drop more like on a trajectory parabola (roughly, not considering air drag).

Is there any easier way to determine the falling point?

In general, yes -- in practice it may be hard. What you're looking for is a closed-form equation for a trajectory parabola with wind drag. The problem is that your ground level varies (at least that's how it is shown in your image). So either way, since your ground isn't even, you would have to do a few iterations with some kind of raymarching. All in all, that's probably nearly as much work as simply stepping in the simulation until you see that ground has been hit.

Depending on the level of realism that you want, it may be allowable to "cheat" and simply let the bomb drop on a quarter-circle path (which looks not very much unlike a bomb would realistically drop). That's very easy to calculate for the animation (instead of doing "proper" physics with forces, simply put the bomb on the circle where it would be at the given time), and it should be very easy find where your heightfield collides with a circle.

Or, just run the proper simulation quickly, as you have envisioned, that will certainly work fine and shouldn't be a problem. A few hundred iterations extra aren't really a problem for a modern computer.

Or, don't show the cross at all, and make the challenge of figuring the correct spot a part of the game

##### Share on other sites

Your general approach (piece-wise integration) is the correct approach with variable ground-height because you can't otherwise determine the upper integral limit.

Just a comment, but your weight-force looks suspicious as it appears to be based on position (and you don't mention what "Q") is. If you're trying to account for the slight change of gravity due to height, you should base it only on height, not position.

EDIT: Also, 1 second integration times seems very long. You may want to experiment with shorter times.

by samoth

Edited by Buckeye

##### Share on other sites

Just a comment, but your weight-force looks suspicious as it appears to be based on position (and you don't mention what "Q") is. If you're trying to account for the slight change of gravity due to height, you should base it only on height, not position.



float Q = eGForce * Weight; // gravity force val  eGForce is 9.81 gravity const     Q euals to m * g //in school they tought me that Q = mg
(maybe you name it somehow differently)

float squareSpeed = VectorLength(vel); //speed squared ;p

t3dpoint WeightForce = Normalize(-pos) * Q; //since i have almost round globe (not just flat ground with heightmap)
i Normalize reversed position to obtain a gravity direction vector and multiple it by weight force

t3dpoint DragForce = Normalize(-vel) * (DragCoeff * ((1.250 * squareSpeed)/2.0f) * 0.760f); bla bla bla 0.768 is an area for mk84 ;] and 1.250 is air dens
(here constant but i have a function for determining the proper airdens)

t3dpoint Acceleration = (WeightForce + DragForce) / Weight; yep still no stabilizators, but it hink they will make bomb go further (checked it by shooting
arrows with bow ;])

pos = pos + (vel * dt);
vel = vel + (Acceleration * dt); //where dt is time between frames

btw thanks for your replies i will iterate towards ground

Edited by WiredCat

##### Share on other sites

I thought that (in the real world), non-guided bombs fall straight down.

Nope, they start off with the velocity the craft had when the bomb was released, then that initial velocity is influenced by gravity (and drag if you factor that in). Otherwise, dropping a cup whilst inside an aeroplane would mean it would shoot to the back of the plane with remarkable speed ;)

##### Share on other sites

i Normalize reversed position to obtain a gravity direction vector

Understood, and now obvious.

1. 1
2. 2
3. 3
frob
12
4. 4
5. 5

• 13
• 14
• 66
• 14
• 15
• ### Forum Statistics

• Total Topics
632130
• Total Posts
3004289

×