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 / line of sight and -static collision

Author
Message
The Cubist
21
Years of Service
User Offline
Joined: 26th Mar 2003
Location:
Posted: 20th Apr 2003 12:06
I ned some help with line of sight in a project I'm working on.
It is a catapult game where opponents hurl water balloons at each other using real physics. I need to know how to check if the water balloon is on target before it gets hurled to set up a collision routine ie explosion etc.I've only been using dark basic pro for 3 weeks.
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 20th Apr 2003 13:58
collcheck:
for n=firstopponent to lastopponent
diffposx2#=abs(object position x(balloon)-object position x(n))
diffposz2#=abs(object position z(balloon)-object position z(n))
collsqrt#=sqrt((diffposx2#*diffposx2#)+(diffposz2#*diffposz2#)
if collsqrt#<80 then "enable collision balloon -opponent"
next n
return

Something like this..
this will enable your collision check routine only when the balloon is less than 80 units from the opponent
The Cubist
21
Years of Service
User Offline
Joined: 26th Mar 2003
Location:
Posted: 22nd Apr 2003 09:00
Thanks Scorpyo. Shoulda realized the old tried and true a^2+b^2=c^2.
And the <80 is meant as a measurement of nearness right?
Greatly appreciated

Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 23rd Apr 2003 01:55
you are welcome..
yes , 80 is the nearness , so you can put any value you like..
additionally , if you introduce in that code a balloon height vs opponent height check to trigger action, you could skip DBP collision check which may eat some frame rate..

Login to post a reply

Server time is: 2024-11-24 10:34:32
Your offset time is: 2024-11-24 10:34:32