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.

Dark GDK / How would I go about this?

Author
Message
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 15th May 2008 22:00
I have an object, and I want to Project an imaginary line from where this object is pointing into infinity, then work out where this infinity reahc on the screen, and put a 2d object where it goes to, making a crosshair at where the objetc is pointing to. how can I do this?
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 15th May 2008 22:05
I don't know how you'd go about it, but do you want a line or a ray? A line extends to infinity in either direction, where a ray has a fixed starting point and then extends to infinity in one direction. It would seem, to me, that you want a ray.

What do you mean by a 2D Object? You can have a sprite or plane which have only two defined dimensions, but very specific advantages over one another.

My site, for various stuff that I make.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 15th May 2008 22:26
I dont want a 2d object in the 3d, I want a actual 2d object, a picture file.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 15th May 2008 22:27
Agreed....

Maybe you could draw a sctech and save it as a PNG of still shot #1, and Still Shot Number 2... like if you move - how the cross hair should go.

When I made the Iron Infantry DBPRO version... I had a heck of a time getting the "cross hair" to match things ... especially in the heli because the gun was UNDER the heli but you're eyes are above it quite a bit in the cockpit...

http://code.google.com/p/ironinfantrydbpro/ Full source, media and exe - 3 downloads under 20meg.. Screenies can be found by following the link in my sig...

I went with the cross hair middle of screen for tank, but a little offset for heli to "try to get close" for most situations.

when I do this again... I'm going to TRY to make it so cross hair ray traces to target.. and gun mathematically aims to that collision point... might be tough getting a limb, on a fluid moving model, to point exactly where I need like that.. but... I'll try it when I get that far!

Good Luck man!

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 15th May 2008 22:30
Umm i donbt have dbpro, and I dont really want to go and search thorugh 20 meg of files in notepad . I fyou could find any relevant code for me it would be greatly appreachiated.
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 16th May 2008 00:44
jezza - the code he gives is in C++ and its very good code

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th May 2008 01:58
Neils thank you.. He's referring to the DBPro version of Iron infantry... let me see what I have kicking around the dizzy magnetic metal thing... that is making a disturbing scratching sound alot...hmm.. LOL....

Well... the code is literally:

for the tank sight crosshair.

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th May 2008 14:55
what is gScreenPct#?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th May 2008 15:03
Global Screen Percentage.



jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th May 2008 15:57
ok, now I see that this isnt the actual relevevant code. Can you show me how you calcualted gTargetCenterYTankGunner# please?
Thanks in advance
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th May 2008 18:05
Quote: "Umm i donbt have dbpro, and I dont really want to go and search thorugh 20 meg of files in notepad . I fyou could find any relevant code for me it would be greatly appreachiated. "


...Plus...

Quote: "ok, now I see that this isnt the actual relevevant code. Can you show me how you calcualted gTargetCenterYTankGunner# please?
Thanks in advance"


...Equals... hold on...




LOL - Hope that Helps. FYI - The whole project is available and even without dbpro I THINK you can use Codesurge IDE to look at the project and navigate kinda like vs2008, except search for text only effects the current window

LOL I GOT to see what you come up with ... Keep me posted! Can't Wait to see what you've done!

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th May 2008 18:48
ok, after reading all that... it doesnt help . Ill have to do this all myself, just not now.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th May 2008 19:59
All I'm doing is positioning the thing based on the size of the display

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th May 2008 20:27
yep, but u didnt really explain that before u said that i should look at ur code
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th May 2008 23:15
LOL - Sorry... Was trying to point you to more than just the crosshairs - few other tidbits in that code

jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 19th May 2008 21:36
thanks to bobba, i was brought to the attention dbObjectScreenX, which is a function that I didntknow existed, but hoped there was something like it. my code is for anyone who is interested:
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 21st May 2008 17:33
Sweet! Glad you got something working - that's very concise.

Login to post a reply

Server time is: 2024-09-29 21:25:02
Your offset time is: 2024-09-29 21:25:02