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.

DarkBASIC Professional Discussion / game concept idea?

Author
Message
ScottyB
18
Years of Service
User Offline
Joined: 26th Jul 2007
Location:
Posted: 11th Jun 2010 23:52
say I shoot a skeet disc some angle out into 3d space and I would like to shoot it down with a gun with the mouse pointer as my targeting crosshair how do I get bullet to follow the aiming device? i.e. mouse
Alfa x
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 12th Jun 2010 00:21
1) you can take two virtual points one at gun position and the other at the gun aiming point plus some distance. Then you take your bullet travel between those two points.

There are several ways to obtain that distance.

1) Mathematically with vectors.
2) Put a dummy object to move x distance in the direction the gun is aiming. (if no gun I think the camera position, plus the camera angles applied to the object.)
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 12th Jun 2010 05:53
Alfa x
Your second method won't work if he wants to keep the camera stationary but have the crosshairs move on the screen.

If it hasn't exploded yet, I haven't touched it.
Mnemonix
23
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: Skaro
Posted: 12th Jun 2010 10:41
Can you somehow get a direction vector for a specific position on the screen? If so, you should use that

Your signature has been erased by a mod because it's larger than 600x120
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 13th Jun 2010 00:41
Quote: "Can you somehow get a direction vector for a specific position on the screen? If so, you should use that "

pick screen and get pick vector x/y/z

ScottyB, I think what you should really be looking for is collision and raycasting. The top recommendation would be Sparky's Collision DLL

Of course, if you really wanted to do it using native DBPro commands, you could find the equation of a line going from the camera position, in the direction of the return values of the get pick vector command, and then see if that line passes through a sphere around the skeet disk, but that would be annoying to implement, scale to multiple objects, or check if other objects are in the way. Sparky's collision is definitely the way to go.


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?

Login to post a reply

Server time is: 2026-07-25 16:21:21
Your offset time is: 2026-07-25 16:21:21