#### Archived

This topic is now archived and is closed to further replies.

# Sidewinder Missiles

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

## Recommended Posts

In the game i am building i want to have sidewinder "like" missiles. i want to achieve an effect like in attack of the clones when the hailfire droids are shooting their missiles at the clones. does anyone have any ideas of how i should go about doing this or at least point me in a direction to learn more?

##### Share on other sites
i think you could create bezier curves in 3space that are in some ways randomized. You can then interpolate the position of the missle along the curve between its origin and its target . . .

##### Share on other sites
thats a great idea using bezier curves. there is one problem i see with it. what about collision detection like if the target moves behind a piece of scenery? i want the missile to chase it to the target''s death or until the target evades the missile.

##### Share on other sites
I saw an article somewhere(im sure here somewhere), About making chasing projectiles to give the realistic appearance of a heat seaking missile. To give curve to the path and etc. I'm sure someone will beat me to finding it. I'm busy trying to make a 3d tower for another post here.

Run a search for it though...

The math behind it confuses me. You would have to keep the missile alive for whatever time you care to.

Say for example... your rocket has exactly 18 seconds of feul.(Or whatever time limit you care to impose)

I agree with going with the idea of shooting them almost in a random direction, then give the appearance of a navigation system taking control after 1 second and interpolating values to come up with a path of travel to the destination

About the target moving behind some scenery... you are now asking for your rocket to be intelligent enough to pathfind... Now your programming some AI, instead of a simple path/effect.

-DD

(edited for a last minute comment)

[edited by - agentidd on March 15, 2003 11:19:01 PM]

[edited by - agentidd on March 15, 2003 11:21:13 PM]

##### Share on other sites
easy. simply simulate a missile gidance system. so have a target and make the missile chase the target. to obtain realism yuo nmust create limits on the manuverabilty of the misisle ths will provide the nice curve efects

##### Share on other sites
i''m also interested in this kind of effects for my flight simulator. The Bezier curve approach is a nice idea, but how can i store every single point of bezier curve in order to use it as a path to follow ? So far i''ve seen examples of bezier curves just showing how to draw them, but none of them explained how to retrieve the points ...

##### Share on other sites
Forget about using beizer curves, just turn the missile towards the target at a slow but set rate perhaps somewhere in between 10-30 degrees per second.
This is the most flexible method.

For balistic unguided missiles just apply some physics to it and it will arc nicely.

##### Share on other sites
the missile should be rotated in y axis to face the target horizontaly and rotated in x axis to face the target verticaly.(the sequent is important). the rate of rotation is multiplied with the different between the missile heading and the angle from the missile to the target. so if the missile is already facing the target, the rotation rate is zero. if the missile is facing away from the target the rate will be higher. this will create a nice curve and damping.

vA = vertical angle between missile heading to the target
hA = horizontal angle between missile heading to the target

K = suitable constant

missile X rotation angle += vA*K
missile Y rotation angle += hA*K

missile position Y += sin(missile X angle)*speed
missile position X += sin(missile Y angle)*speed
missile position Z += cos(missile Y angle)*speed

this assumes that missile zero heading vector pointing to (0,0,-1)

##### Share on other sites
Thanks to the anonymous, the code is really OK ! But regarding Bezier curves i don''t understand: you give the 4 control points and you go for the curve, that''s fine, but why can''t we retrieve every single point ? I mean, that''s would the opengl function does, right ? Or those points are just calculated and used to draw the curve but are somehow "prohibited" to retrieve ?

##### Share on other sites
You know, the bezier curve idea is not very good. giving the missile a little bit of AI, like anonymous posted, it works so much better. i tried both ways and the AI way works the best.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 15
• 13
• 9
• 12
• 10
• ### Forum Statistics

• Total Topics
631442
• Total Posts
3000089
×