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 Discussion / Point and Shoot - Make sure crosshair intact

Author
Message
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 29th Sep 2003 05:15
Bare with me please... The mini-game I'm making is a 3rd person chase-view shooter set in an endless cave made up of 2 sandwiched matrixes. One feature I'm trying to implement in the mose effecient fashion is crosshairs that are positioned in the direction that the 3rd person ship is firing. I want the crosshairs to always be shown in front of the matrixes while keeping their accuracy integrity. I don't care if I have to position the crosshairs directly in front of the player-ship if it's about to collide with a wall, I need them always visible. Is there a 3D line equation I can implement to make this happen.

I realize that this is a hard question. I do not expect an answer soon.

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 29th Sep 2003 06:04
Okay, guys, you can stop laughing now I solved my own problem. Basically I am programming an algorithm to remove distance from the crosshairs and the player until ground height integrity is reached.
Sorry about that, I can be such a crybaby sometimes...

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Sep 2003 11:02
Object Intersection might also help you to position the crosshair when it's against your walls

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 29th Sep 2003 17:04
Well, The algorythm I'm working on is running into a few bugs. Please tell me about your Object Intersection method.

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 29th Sep 2003 18:56
Well, so far I can get the distance between the crosshair and the player using Pitagora's Theory (d = square(delta_x^2+delta_y^2+delta_z^2)) If one were to say that the two points made up a line segment in 3D space, how could I go about shortening the line relative to the initial position until I get a value that Get Ground Height would find acceptable?

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Sep 2003 01:50
My suggestion is a simple INTERSECT OBJECT command.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 30th Sep 2003 18:31 Edited at: 30th Sep 2003 18:33
Thank's I'll look into that. Before I got your response I talked to some of my math professors and they said I should use parametric equations to accomplish the goal.
It looks somewhat promising, but I'm afraid that part of my problem stems from the fact that the crosshairs need to stay above the matrixes, not touching it. I need my algorithm to position the crosshairs at the same angle until ground height is half of the plain's height above zero for the bottom matrix, and half the plain's height below the top matrix.

I'm sorry, but after all the work I did researching parametric equations it's hard to believe that a simple INTERSECT OBJECT" command will get the job done (if it does I'm going to beat my head against an oak tree)...

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 1st Oct 2003 17:47
Ever thought of just using a 2D cross hair that wont disapear at all if you st DRAW TO FRONT (which is default anyway) and then move it about on a 2D area (the screen) to make it look as if its in 3D space...?

And if you want a three dimensional look to a 2D Drawing... you can always just strech the sprite so for when you wish it to apear further away, stretch it so its smaller, and for closser up, stretch it so its bigger...

Just a sggestion.

Hope I Helped...

If Quizz's Are Quizzical, Then What Are Test's?
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 2nd Oct 2003 07:17 Edited at: 2nd Oct 2003 07:22
Because this is a third person crosshair - I have a bad feeling that your suggestion your conflict with the ship that is witnessed in front of it. The best way of describing the game I'm working on is Star Fox 64 in a cave.

I've looked throughout all of my Darkbasic help files and can't seem to find Intersect Object anywhere. If I do the parametric equations properly, it should still be quite effecient - I hope.

Please fill me in some more on this Intersect Object command - I can't seem to find it anywhere!
[edit - I sure hope it has nothing to do with DBPro, cuz this is the DBClassic thread and I only have classic...]

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
Northern Fist
21
Years of Service
User Offline
Joined: 23rd Sep 2003
Location:
Posted: 6th Oct 2003 02:36
Well, I've finally been able to find the time to play around with a few parametric equations that I've been attempting to program. Nothing seems to work, and I am now assuming that Intersect Object is a DBPro command.

Could anyone else confirm my assumption, please?

"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 6th Oct 2003 14:24
Post it in the DBPro forum and you'll get an answer there...

Hope I Helped...

If Quizz's Are Quizzical, Then What Are Test's?
Check my profile for a quick test of knowladge...

Login to post a reply

Server time is: 2025-05-20 13:46:31
Your offset time is: 2025-05-20 13:46:31