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 / targeting cross hairs

Author
Message
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 17th Sep 2003 09:15 Edited at: 17th Sep 2003 09:18
I am trying to get my cross hairs to change color with collision detection
Both images have boxes for collision
200 is my blue cross hair
201 is my red one
when 200 collides with something i want it to dissapear and the other appear.....

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th Sep 2003 09:24
I haven't tried this but I think you need to use Vector. I could be completely wrong but just logically your crosshair should not be touching the enemy, only pointing at it. Hopefully other vets here will help.

vets?

-RUST-
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 17th Sep 2003 12:46 Edited at: 17th Sep 2003 12:47
if u want like cattlerustler says and change target to red when enemy is in your cross hair line of sight then i would use INTERSECT OBJECT

ob=target object
x=cross hair x
y=cross hair y
z=cross hair z
x1=x+(cos(camera angle y)*bullitdistancelimit)
y1=y+(sin(camera angle x)*bullitdistancelimit)
z1=z+(sin(camera angle y)*bullitdistancelimit)

if intersect object(ob,x,y,z,x1,y1,z1)
target in range
.....
endif

Now my cos's & sin's are probably arse about face so you may have to change em about a bit. And if you still can't get it to work then ask a trigonometry guru (which aint me )
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 17th Sep 2003 17:31
ok it seems that my version of dark basic doesnt recognize the INTERSECT command. I tried a context help on it and it could'nt find it....
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th Sep 2003 20:05
ahh, INTERSECT OBJECT. I'll remember that one. lol where did I get vector from?

who knows

-RUST-
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Sep 2003 02:55
I assume that you are using DBC and not DBPro.

One way is to use a long thin hidden box that extends out in front of you and use that to detect collision with anything directly in front
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 04:16 Edited at: 18th Sep 2003 07:09
so what you mean is that i can create a long thin box on the z axis of the players screen and detect collision with that.....

great idea...but will that slow down the program?

shouldnt too much since it wont be rendered....

will the program still be able to detect collision even if i
hide object ID????
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 07:14
hmmm....that doesnt seem to be working....cant figure out why tho.....it should work.....here is what i have done



i am locking the long thin box to the center of my screen and setting it way out in front of me and its not colliding with any thing.....even if i get right up on top of any thing....

i have all the other objest set to boxes and i have turned on object collision on all objects.....
zzabb
21
Years of Service
User Offline
Joined: 25th Apr 2003
Location: Seattle, USA
Posted: 18th Sep 2003 09:20
someone will have to correct me if i'm wrong, but i don't think the collision works if you lock it to the screen
i should say i couldn't get it to work, i was doing something else but tried a similar idea
i haven't tried it with DBPro maybe it does with that?
but i couldn't get it to work in DBReg
i had to use math collision based on the objects positions

My advice is free -
unfortunately you get what you pay for (-:
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 16:07
so you got something similar to work....can you post the code here for me....i havent even attempted math collision yet....the docs say its more accurate.....

and yeah i think your right about the lock screen part....that is my only guess....

unless i make it to where it places that object hidden in front of the player and dont lock it and some how move it with the player
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 18th Sep 2003 17:17
have you tried object screen position x() ? and y yet. If your X is locked to the screen center, say 300x400 on a screen 600x800, and the object is in the screen at about the same point, change cross hairs. That should work and be rather straight forward. No collision stuff to even worry about.

internet gaming group
zzabb
21
Years of Service
User Offline
Joined: 25th Apr 2003
Location: Seattle, USA
Posted: 18th Sep 2003 19:24
please forgive the code i know its rather convoluted but you asked for it (-:
I am certain there are much better collision systems out there that you could use
this was the first game i made by myself (-: so please take it with a grain of salt
the game i made was like the old joust game but in 3d so it isn't exactly what you want
the collision worked but i couldn't get the game to fly right so i gave up on it
this would only work at a fixed distance to the camera
so it isn't cross hairs but it may give you an idea to start
hope it helps

My advice is free -
unfortunately you get what you pay for (-:
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 19:36
you mean object position x() and y.....then no....and i just tried these commands and it still doesnt work...

i am using DBC ....not pro..so if the commands you mentioned are in pro then i be screwed....lol....



this is how i am doing it....now that i think about it this wont work....object position y() and x show where the object is placed.....not neccesarily the part your looking at.....and since i am using a rolling hill terrain it wont work cuz the Y value is always going to be different.....

grrr....

oh the reason its checking for 81 objects is cuz i am just putting random objects in there as walls to mess around with so i am using those as the items to target......when this is finished it will have 32 peeps max and only 16 on a team at a time so i will only have to check for 16 targets......
zzabb
21
Years of Service
User Offline
Joined: 25th Apr 2003
Location: Seattle, USA
Posted: 18th Sep 2003 19:51 Edited at: 18th Sep 2003 19:52
crap part of the code i posted got left out of the source????
i hate it when it does that

here it is again


My advice is free -
unfortunately you get what you pay for (-:
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 18th Sep 2003 20:02
hhhmm.....i sorta see what your doing there....but your right...its not what i need.... your doing object collision for fighting....

what i need is some what of being able to tell if an object is under the cross hairs or not..... i can do object collision for items out in 3d space...it just doesnt work for items locked to my screen.....
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 18th Sep 2003 20:15
Maybe the crosshair could be 2d and you use object screen x/y to determine if there was a hit?

c:/dos
c:/dos run
run dos run
zzabb
21
Years of Service
User Offline
Joined: 25th Apr 2003
Location: Seattle, USA
Posted: 18th Sep 2003 20:29 Edited at: 18th Sep 2003 21:16
good idea something like
this isn't code just an idea
make the cross hairs a sprite and color or change the sprite

for t=1 to numberofobjects
if OBJECT IN SCREEN(t)=1
if OBJECT SCREEN X(t)=screenwidth/2 and OBJECT SCREEN Y(t)=screenhight/2
turn cross hairs red
else
turn cross hairs blue
endif
endif
next t

just a thought

My advice is free -
unfortunately you get what you pay for (-:
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 19th Sep 2003 04:16
where do ya'll see that object screen x/y() command....i have looked through my help files and cant find it.....maybe that is my problem.....i only see object position x/y()....
zzabb
21
Years of Service
User Offline
Joined: 25th Apr 2003
Location: Seattle, USA
Posted: 19th Sep 2003 05:53
if you go into commands menu in the DB help files
look under basic3d
near the botton of the page just above
Return Value=GET STATIC COLLISION HIT

My advice is free -
unfortunately you get what you pay for (-:
Orion Pax
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location:
Posted: 19th Sep 2003 08:01
ahhh...yeah now i do...i just didnt go that far....i thought it was like one of the other commands instead of one only displaying a result....thanks i will try that tomorrow evening....

Login to post a reply

Server time is: 2024-11-25 08:19:47
Your offset time is: 2024-11-25 08:19:47