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.

Work in Progress / Need help with a range finder

Author
Message
Prowler
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location:
Posted: 8th Dec 2005 09:04
Hello,

I need help getting the distance between the camera an the objects (including terrain)in a game. The idea is to show the distance in a range finder scope like the ones used for hunting.

Any ideas on how to do this and code snippets are welcome.

Thanx
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 8th Dec 2005 14:45
Just so you know questions about coding belong in the DBPro, DBC, or Newcomers boards. (DBPro board if you use DBPro, DBC board if you use DBC, and Newcomers board if you don't know what you are doing)

The distance between two points [(x1,y1,z1) and (x2,y2,z2)] is


but i don't think that's what you want... from your post it seems like you want to be able to look down a sniper rifle or something and see how far away the thing you are pointing at is...

what i would do is make a tiny invisible sphere, position it at the front of your gun (or wherever you want the distance checking to start) then use "Intersect object"
setting the second point to a far away point on the same line that your gun is pointing on...

that probably made no sense whatsoever (i'm not very good at explaining things sometimes)... but oh well

--Peter

"We make the worst games in the universe..."
Prowler
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location:
Posted: 8th Dec 2005 20:48
Thanx Peter That's exactly what I needed. Sorry for placing the post here.
Sergey K
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 12th Dec 2005 12:46
its called Distance formula


BlueLightOnline Coming Soon. (95%)

Login to post a reply

Server time is: 2024-11-23 11:20:03
Your offset time is: 2024-11-23 11:20:03