Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Lock on function.

Author
Message
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th May 2005 03:36
This function will make your missile turn to an object at a given speed.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 14th May 2005 12:13 Edited at: 14th May 2005 12:13
It's a good start - I've been looking for something like this. I want units to move (like tanks) that will turn towards their destination while moving.

There are a few problems. First - it wouldn't compile because the function call and the function name don't match. Second, I tried moving it (like a missile would be). It starts out working, but then gets confused as I move the target around.

Still - overall, I will find this useful. Thanks.



"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th May 2005 02:19
Mmm, guess i did somthin wrong...
i think it's because if you pitch and turn, your bullet will be zrotated...
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th May 2005 02:14
I wonder if Fix Object Pivot will work?

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
UnderLord
20
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 16th May 2005 12:20
put the code into the code base =)

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 17th May 2005 04:05
Maybe I can fix this by rotating the object around the z-axis and y-axis...

I don't think someone would like a non-working code
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th May 2005 16:41 Edited at: 17th May 2005 16:43
Yeah - it belongs here for now. It's still usefull though as a good start / food for thought.

Also, z-axis is roll. It might be more useful to use x/y-axis instead of y/z-axis. But I'm guessing here - otherwise I would have written it.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 22nd May 2005 02:15
Or you can allways make a dummy that's keep pointing at the target and let the angles of the real bullet slowly turn to the dummys angles...
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 26th May 2005 15:11 Edited at: 26th May 2005 15:11
I've tried that technique for a few AI's, but I want to run, let's say, a hundred AI's. Haven't tried it, but I think it would start to really slow down. Where as a math solution would work much faster.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th May 2005 23:05
Indeed...

Anyway, maybe my code can help ppl with AI codes...
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 30th May 2005 02:50
Okay - been playing around with your start for a while now and finally got to this. It doesn't look the same at all, but you can still see the basic concept is there.

Solutions:
Used 5 limbs (limb 0 + 4) for each basic direction (forward, up, down, left, and right).
Offset the limbs in their respective directions.
Get the distance from each limb to the target.
Determine the closest limb to the target.
Turn the missile object in the direction of the closest limb.
Move the missile forward.
Rinse and repeat.

Note: There are more functions than are used as I have a basic function include file I copy functions from as needed. I just copied the ones I might need and didn't bother to delete them if I didn`t use them.

Note: 100 missiles in this demo just to test speed.



Thanks Sven!

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Jun 2005 04:02
Well, I actually use DBC, so I can't execute your source code :s

Immunity and Annihalation makes Immunihalation...
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 2nd Jun 2005 13:33
Here's a conversion to DBC. It compiles okay in DBC and it work properly in DBPro, but it doesn't work quite right in DBC. It's beena while since I worked with DBC so I forget some of the little nuances. Maybe you can help finish the conversion?



"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 5th Jun 2005 06:15
I'm sorry, but the missiles go everywhere except for the cube... (But there aren't any DBP commands so you got that right)

Immunity and Annihalation makes Immunihalation...

Login to post a reply

Server time is: 2024-04-25 02:25:26
Your offset time is: 2024-04-25 02:25:26