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 / cave runner code, intersect object, and collision

Author
Message
2122
19
Years of Service
User Offline
Joined: 15th Aug 2005
Location:
Posted: 31st Aug 2005 06:30
Can someone post the code for the cave runner program that comes with the dbc demo?
How does the intersect object command work? I can't figure it out.
Is there a way to rotate a collision box, so that I can use a tilted box for a ramp?
Is there a way to find out if an object is sitting on top of something, or colliding with the side?
Thanks in advance.
Fox Dark Master
20
Years of Service
User Offline
Joined: 20th Jul 2004
Location: Portugal
Posted: 31st Aug 2005 11:46
one question...if you know that the code is in the demo, why don't you copy it?


True Phantasy
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 31st Aug 2005 13:01
2122;

1:
I didn't find the intersect object command, so I can't help you out here.

2:
A collision box can be rotated simply by putting a 1 at the end.
make object collision box obj,x,y,z,x2,y2,z2,1

However, when using a 1, sliding collision data cannot be used.

3:
You can determine wich side is hitting something by using sliding collision data (look at nr 2).

With using these commands:
object collision x()
object collision y()
object collision z()

To determine the side, you have to do it as followed:


Also, here is the caverunner demo with the tutorial pages.

Immunity and Annihalation makes Immunihalation...

Attachments

Login to view attachments
2122
19
Years of Service
User Offline
Joined: 15th Aug 2005
Location:
Posted: 31st Aug 2005 17:49
Thanks for the help. The intersect object command is in dbp.
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 31st Aug 2005 21:08
intersect object casts a straight ray from a start x#,y#,z# position (world coordinates) to an end x#,y#,z# position and reports the distance of the checked object in world units from the "start" coords, if the checked object gets hit by the ray, otherwise reports 0:

objnumdist#=intersect object (objnum,fromx#,fromy#,fromz#,tox#toy#toz#)

suppose you want to check distance from your player position x#,z# at a height of 50 units parallel to the ground against a house that can be as distant as 10000 units(it can be any distance,even much bigger):
your player position would be x#,50,z# (or object position(x#),50,object position(z#);
i.e. your start or "from" values for intersect object command).

Then, depending on player angle your "to" coords of the ray will be:

tox#=newxvalue(x#,playerangle#,10000)
toz#=newzvalue(z#,playerangle#,10000)

housedist#=intersect object(house,x#,50,z#,tox#,50,toz#)

whenever your ray hits the house, housedist# will report the distance, otherwise you will get 0.

hope it helps
2122
19
Years of Service
User Offline
Joined: 15th Aug 2005
Location:
Posted: 1st Sep 2005 01:06
Thanks for the explanation. I think I'll try that, it might make the ramp better. I played with the get collision command a bit, and I have a ramp that you can go up. If anyone knows a better way to do this, let me know please.

Login to post a reply

Server time is: 2024-09-24 03:21:00
Your offset time is: 2024-09-24 03:21:00