# shooting missle/falling bomb from a ship

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

## Recommended Posts

Hi Please look at my demo game. or here in
">youtube(they are just the same). You can see the ship looks like its dropping poo. Anyway, what I want to achieve are 2 things. 1. A more realistic drop of bomb - i think i have to use a capsule shape and re orient the head to slowly point downwards while its falling 2. missile - this is probably hard, the effect i want here is the ship to sweep/swoop/fly over to the house and halfway near, it will fire a missile(again a capsule or cylinder shape), the missile will track to the target and fly towards it realistically. Thanks for your ideas.

##### Share on other sites
The biggest problem I see in that demo is that the bombs drop vertically, even though they were released from fast-moving aircrafts. The trajectory of a bomb should be roughly a parabola. Whether the bomb tilts downward or not will matter little compared to this violation of Newton's first law.

##### Share on other sites
bomb? trajectory? hmm... i imagine the bomb should just falling downwards, and its head orienting/tilting towards the ground no?

The missile would be release halfway when the ship is halfway through its target. I probably should do the following for the missile:

1. When fired, push it down a bit.
2. Have it seek to the target.

I think these may be just bunch of path interpolation. The bomb would probably just orienting its head.

Anyway, i'm still open to other ideas.

##### Share on other sites
"An object in motion stays in motion unless acted on by an unbalanced force."

If you drop a bomb from a plane it will have the same velocity of the plane. The reason it doesn't stay with the plane is because lift on plane balances with gravity so the plane doesn't fall. The bomb on the other hand will gradually fall with an acceleration of 9.8 m/s^2.

The easiest way to get the rotation matrix of the bomb is by using the velocity of the object. Meaning the bomb will point in the direction it's moving. This is the simplest way to do it.

##### Share on other sites
Immediately after being released, the bomb will have the same velocity (and hence direction of travel) as the plane. There are then two forces acting on the bomb: gravity and air resistance.

Gravity is simple, F_g = m * g, where m is the mass of the bomb (in kg) and g is 9.81 m/s^2. The direction of this force is down.

Air resistance is a bit trickier, but can be approximated by F_d = 1/2 * C_d * v^2, where C_d is the drag coefficient of the bomb in air, v is the speed of the bomb (length of the velocity vector). The direction of the drag is the opposite of the velocity.

Lower drag coefficient will make it arc more slowly than a higher drag coefficient.

In order to orient the bomb, you can simply rotate it so that the length of the bomb is parallel to the velocity vector (either figure out the angle or just construct a rotation matrix directly from the velocity vector). I think that'll look good.

##### Share on other sites
Quote:
 Original post by Lord CrcImmediately after being released, the bomb will have the same velocity (and hence direction of travel) as the plane.

Hmm... I think I'm getting confused here.

The bomb shouldn't follow the same velocity as of the plane. I'm showing 2 images which shows the 2 types of behaviour i want to exhibit.

and

So I like a carpet bombing similar to the first screen shot.

I think you guys are pointing out how its suppose to behave on the second screen shot - but yes ill give that a try - without air resistance first. :)

##### Share on other sites
In your first image the bombs seems to drop straight down because the viewer is moving at the same speed as the plane dropping the bombs. The bombs fall under gravity but when they leave the plane they are moving forward at the same velocity as the plane. As soon as they leave the plane they will start to accelerate downwards (because of gravity). So the bombs follow a parabola, they don't drop straight down. The bombs will also loose some forward momentum because of air resistance, but you can probably ignore this for bombs dropped at low altitude.

##### Share on other sites
Here are a couple of youtube videos that show how the bombs that are being dropped are indeed moving in the same direction of the aircraft that dropped them.

Cluster Bombs
">

Dambuster Raid
">

##### Share on other sites
Quote:
Original post by mickeyren
Quote:
 Original post by Lord CrcImmediately after being released, the bomb will have the same velocity (and hence direction of travel) as the plane.

Hmm... I think I'm getting confused here.

The bomb shouldn't follow the same velocity as of the plane. I'm showing 2 images which shows the 2 types of behaviour i want to exhibit.

So I like a carpet bombing similar to the first screen shot.

I think you guys are pointing out how its suppose to behave on the second screen shot - but yes ill give that a try - without air resistance first. :)

No, they're not. The way they've described will perfectly model the 1st screenshot, as you want.

Quote:
 If you drop a bomb from a plane it will have the same velocity of the plane. The reason it doesn't stay with the plane is because lift on plane balances with gravity so the plane doesn't fall. The bomb on the other hand will gradually fall with an acceleration of 9.8 m/s^2.

Read that over again and look at your screenshot.

In any case, here's a solution for you in simple math:

When a bomb is dropped:
bomb.position.x = plane.position.x
bomb.position.y = plane.position.y
bomb.velocity.x = plane.velocity.x
bomb.velocity.y = plane.velocity.y

Every time physics are updated:
bomb.velocity.y -= 9.8 * time_passed_since_last update (in seconds)
bomb.position.x = bomb.velocity.x * time_passed
bomb.position.y = bomb.velocity.y * time_passed

Note that it only uses gravity and ignores air resistance, which isn't that important to get what you want.

##### Share on other sites
Quote:
 Original post by shurcoolIn any case, here's a solution for you in simple math:When a bomb is dropped:bomb.position.x = plane.position.xbomb.position.y = plane.position.ybomb.velocity.x = plane.velocity.xbomb.velocity.y = plane.velocity.yEvery time physics are updated:bomb.velocity.y -= 9.8 * time_passed_since_last update (in seconds)bomb.position.x = bomb.velocity.x * time_passedbomb.position.y = bomb.velocity.y * time_passed

If you want to see that sort of physics in action, take a look at my Sopwith clone in Flash (a 2D side-view airplane fighting/bombing game).

http://www.cse.yorku.ca/~cs243104/Sopwith.swf Press F to take off, left/right arrow keys to turn, and B to release a bomb.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5
A4L
12

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013541
×