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 Professional Discussion / cOlLiSiOn, COLLISION, help, i have a headache

Author
Message
Jimmy Cool
23
Years of Service
User Offline
Joined: 6th Mar 2003
Location: United States
Posted: 14th May 2003 05:46 Edited at: 16th May 2003 04:54



see that? that's a simple multiplayer game i'm making to test some concepts before I get involved in a bigger project. I've got all these differently scaled rocks you see, and I want to be jumping on top of them and stuff, and i've got collision boxes on them, but I don't want boxes! i want rocks! you see what i'm saying? if the rock slopes, I want to slide down and off, you see? so how can I collide with the rock and not the box, thanks

oh, and isn't my GUI the coolest? lines are bestest

***********************************************
Me, i'll just be here crying my brains out
Barliesque
23
Years of Service
User Offline
Joined: 10th Nov 2002
Location: Los Angeles
Posted: 15th May 2003 13:58 Edited at: 15th May 2003 14:11
No screenshot appearing, but I get the idea. I'm working on something with a similar requirement.

Use the function: INTERSECT OBJECT()

This looks for collision with a specified object from a given starting point (ie, your player's position) in a given direction. If you specify point 2 as 10 units straight down from your player's position, the command doesn't stop there, it'll look for a collision with the object at any distance, straight down.

So how do you know if your player's standing on a rock, as opposed to jumping or falling through the air? If the collision distance returned by this function is equal to (or less than) the distance from the origin of your player model to his/her/its feet, then you're there.

To determine he slope, look at the collision distance from two or three test points around the area of your player's feet. Then form a triangle with the difference between the (in this case two) measurements.

A_____ B
|........../
|......../
|....../
|..../
|../
|/
C

Leg AC of the triangle is the difference between the two measurements. Leg AB is the distance between your two test points. Angle A is your slope. So, to calculate angle A use the trig function Tangent: Angle_B# = TAN(Opposite/Adjacent) ...or... Angle_B# = TAN(Leg_AC / Leg_AB)

This simple formula is for 2D. The 3D formula is somewhat more complicated. I haven't got it at hand, so if it's a 3D game, let me know and I'll post that for you.

Good luck!
Scorpyo
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 15th May 2003 23:33
check this thread and download and run the walktest.zip
it may help you
cheers

http://www.realgametools.net/forums/index.php?board=3;action=display;threadid=15135;start=20
Jimmy Cool
23
Years of Service
User Offline
Joined: 6th Mar 2003
Location: United States
Posted: 16th May 2003 04:50
ok, sorry, let me simplify my question :-s heh, i'm dumb i know

basically i want to know..

do I have to use object collision boxes?? i'd prefer if my collisions weren't based on a friggin box, cuz I plan on having big ole trees you can climb on and crap and BOXES are not shaped like TREES.. or vise versa

thanks

***********************************************
Me, i'll just be here crying my brains out
Barliesque
23
Years of Service
User Offline
Joined: 10th Nov 2002
Location: Los Angeles
Posted: 16th May 2003 07:10
Quote: "do I have to use object collision boxes?? "


No. Not if you use the INTERSECT OBJECT() function. The results are based on individual polygons.
Jimmy Cool
23
Years of Service
User Offline
Joined: 6th Mar 2003
Location: United States
Posted: 16th May 2003 08:04
ok
i do

intersect object(1, 0, 0, 0, 0, -10, 0) and it returns 0, constantly

***********************************************
Me, i'll just be here crying my brains out
Barliesque
23
Years of Service
User Offline
Joined: 10th Nov 2002
Location: Los Angeles
Posted: 16th May 2003 14:36 Edited at: 16th May 2003 14:38
Is there an object below that point? The code should look something like this:



Hope this helps.
[b])

Login to post a reply

Server time is: 2026-07-11 01:54:51
Your offset time is: 2026-07-11 01:54:51