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.

Newcomers DBPro Corner / Does anybody have the code to make a target lead indicator???

Author
Message
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 26th Feb 2004 20:27
Hi everyone,
I have been searching for ahile for a system to set up a target lead indicator for my space shooter. A target lead indicator is a marker that appears infront of a target showing were you should shoot if you want you projectile to hit its mark. Does anybody have anything that can help?
BTW<>i posted this earlyer in the code section but just realized that they only want finsished code there, and not requests, so i moved it here
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Feb 2004 21:07
I'm hypothesising here...

You could put a hidden plain, at the same point in front of you that you want your "target lead indicator" to appear, then use INTERSECT OBJECT type commands to position it based on the polygon you have intersected. I don't know how far this command goes, nut NGs collision DLL allows you to Ray Intersect and position with precision.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 26th Feb 2004 21:35
use newxvalue/newzvalue/newyvalue to calculate how far in front of the ship the player should aim, position a dummy object there, hide it, and use object screen x+object screen y to position a sprite with your lead indicator image on above the object.

In the beginning, the universe was created...
This made alot of people very angry and it has been widely regarded as a bad idea...
Visit http://redeye.dbspot.com
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 26th Feb 2004 22:12
you need to know some things first, like how fast you're projectile is moving, how fast the enemy ship is moving and then need to calculate how far the target lead should be of the enemy ship



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 1st Mar 2004 20:14
i know how to determin the speed etec., but i dont know how to caluculate were to place the indicator
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 1st Mar 2004 20:48
The easiest way is to place the marker (as a transparent billboard) out in front of the selected enemy unit. The distance from the enemy unit is a multiple of enemy speed and time it takes for the guns/missiles from your fighter to get to the enemy.

For example, if the enemy is moving 10 units per second and it takes 500 ms for your shots to get near the enemy, you would place the indicator (10 * .500) = 5 units in front of the enemy. You would update this position every loop to adjust for enemy acceleration/deceleration and turning. Also, after placeing the marker, you can use the point object command to face the marker always at the camera.
--
TAZ

DBasic Khan
20
Years of Service
User Offline
Joined: 3rd Dec 2003
Location: Alpha Quadrent, Sector 1,1 SOL SYS
Posted: 2nd Mar 2004 20:55
im not sure if that would work, cause if u think about it all u r doing there is determining were it was. But that might work, im just not quite sure. Ill have to try it. Thanks Taz
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 2nd Mar 2004 21:32
Remember, you're updating every game loop, so the 'lag' is measured in fractions of a second. You can create more exacting prediction logic, if you want a simulator and not a game. You can display manuver cones, factor in closing and opening range situations, include indicators for various weapon speeds, etc.
--
TAZ

Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 4th Mar 2004 07:08
Creating a target lead indicator just requires some basic trig and vector maths. This would make a good example project for my 3d vector maths tutorials which I shall be writing in mid April (see: http://darkbasicpro.thegamecreators.com/?m=forum_view&t=26668&b=2). Therefore, you can expect this topic to be covered in those tutorials with a full explanation of how to write one (including example source).

Other topics which I am planning to cover in the tutorials (as examples) to date include:

1. a "work around" example of how to get accurate X, Y and Z angles for objects being rotated and translated using the DBPro freeflight commands;

2. an example 3d space radar;

3. a lensflare; and

4. a pseudo-newtonian system of movement.

Watch this space.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home

Login to post a reply

Server time is: 2024-09-22 00:41:15
Your offset time is: 2024-09-22 00:41:15