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.

3 Dimensional Chat / ocean collision

Author
Message
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 21st Oct 2003 03:49
i have very large plains acting as the ocean at my game, placed at y coordinate zero. there is no need for swimming; i want you to stop when you get to the water. i dont need anything fancy about it like sliding collision, just normal collision is fine.

in DBC i had this code:


now that im using dbp, it wont work the same way. i edited the yc# = ground height to yc# = oldyc#, but i dont think this would make a difference. reason is that there are no matrices in the dbp program, i am using kensupen's .x collision code.

any ideas on how to make camera y=0 collision?
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 21st Oct 2003 05:17
If it a plane, why even bother wasting CPU cycles on a function call?

Let's say sea level is always zero. Simply set yc# to 45.
--
TAZ
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Oct 2003 12:32
Yeah, that's what I would do - something like:

rem Ocean collision
if yc# < 45
xc# = oldxc#
zc# = oldzc#
yc# = oldyc#
endif

Don't set yc# to the ground height, set it to the last >45 value to match the last X and Z locations, otherwise you could end up under the landscape.


Van-B

zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 21st Oct 2003 16:23
One possiblity if you want it to skip or slide along the ocean top is to only reset yc#. They will create a sliding collision effect where the model will continue to move but not loose any more altitude.

Of course, if you want to avoid people using the ocean as a 'wing in ground effect' vehicle, you can add significant turbulence to aircraft that hit the minimum altitude test (small but constant turning, rolling, and pitching.) Maybe adding an annoying collision alert klaxon will get them to gain altitude as well.
--
TAZ
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 22nd Oct 2003 00:27 Edited at: 22nd Oct 2003 00:30
Sorry I guess I didn't make myself clear enough

rem Ocean collision
if yc# < 45
xc# = oldxc#
zc# = oldzc#
yc# = oldyc#
endif

that code works in DBC. the same does not work in DBP, I get stuck at my position when i collide with ocean.

"Let's say sea level is always zero. Simply set yc# to 45."
then i would be able to walk on the water, right?

van B i dont set y to < 1, in the dbp program it's
[/code]
` OCEAN COLLISION
if cy# < 41
cx# = oldcx#
cz# = oldcz#
cy# = oldcy#
position camera cx#, cy#, cz#
endif
[code]
(EDIT:note the char height is 40#)
there is also the problem of jumping/skipping across the water
when i purchase DBP (im using trial version) ill look at their examples and stuff for the intersect object command, and try to do ocean collision with a get ground height thing for a .x obj

unless anyone wants to give me a function that gives me the y position of a face of .x object 1 at coordinates cx#, cz#.. that would be nice of u

this would help with ocean collision, as well as not being able to jump onto the ocean, as well as for you to not be able to control the character while in midair (if going in arc off a cliff or something; jumping is already taken care of), as well as positioning buildings added into the game onto the right ground height

chris
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Oct 2003 11:08
Look around, there's lots of maths collision systems for .X files. Of course you'd need the heights of each corner, so it's pretty tricky - I usually go the opposite way, make a memblock mesh based on heightmap and tile texturing data, but I use Kevils getgroundheight function and it works a treat. I strongly suggest looking for that, although there's no reason why you can't use matrices for now and change later if you like.


Van-B

zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 23rd Oct 2003 03:41
Whoa! You're getting the height of a plane! That's a constant value. Unless the whole plane is tilted or bobbing up and down, you don't need to call a function to get the height.

> "Let's say sea level is always zero. Simply set yc# to 45."
> then i would be able to walk on the water, right?

Given that a plane has a constant height, doesn't this do the
exact some thing?

yc# = get ground height(1, xc#, zc#) + 45

If the planes is at 0,0,0 (for example), no matter where you hit the plane, the height is going to be zero + 45
--
TAZ
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 24th Oct 2003 03:58
i know that no matter where you hit the plane your height will be 0 plus your character height.

what i want is for you to not be able to enter an area where you height is zero plus character height.

basicly to stop when teh height is a certain level
Genesis Rage
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location:
Posted: 24th Oct 2003 06:12
is 'kensupen's .x collision code' freeware... and if so.. where can you get it?

==Main Computer==
Athlon XP 3000+, 1024mb, Radeon 9800 Pro, XP Pro, DX9
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 25th Oct 2003 05:58
@genesis
http://darkbasic.thegamecreators.com/?m=forum_view&b=6&t=10315&p=2

Login to post a reply

Server time is: 2025-06-27 10:27:41
Your offset time is: 2025-06-27 10:27:41