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 / Make an object "skim" a surface?

Author
Message
tgm4l
18
Years of Service
User Offline
Joined: 21st Oct 2007
Location:
Posted: 8th Jul 2010 01:57
Is there a way to make an object go to the highest point on another object, given the X and Z positions (the Y position would depend on the floor object?

The reason I want to do this is to make world collision easier, I could put an invisible cube in front of the player and enemy objects. The cube will go to the highest point of a specified object, then, if the Y value difference is too high, the player/enemy won't be able to go there, otherwise the player will keep moving, following the "terrain".

I can't use a terrain for this because it will include buildings.

If i need to explain this in another way, sorry, I failed



Thanks for the help.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 8th Jul 2010 09:39
Of course you can use terrain for this?

The Sparkies plugin allows you to setup collision groups. Just add the terrain and buildings into the same group and bingo.

But to really answer your question, you can do this with the intersect object commend, but I'd still highly recommend switching to sparkies.

My signature is NOT a moderator plaything! Stop changing it!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 8th Jul 2010 10:18
A lot of people just work out the slope factor, like - if you work out the distance travelled in that loop, and divide the height difference by that, you have your slope factor - maybe possible to slide with that as well.

I would make a function that takes 2 sets of 2D XZ coordinates, works out the slope factor, and returns a 1 if the slope is too steep. Then, with a cross axis check, you could have it slide around slopes as if they were solid walls - rather than just stopping dead. You could store the previous 2D location, and pass that through the slope check function, if the slope is too steep, you can check the previous location on each axis seperately.

All you would need is a way to check the height of the level, sparkies line intersect check is ideal for this, as Mobiius said.


Health, Ammo, and bacon and eggs!

Login to post a reply

Server time is: 2026-07-25 08:13:36
Your offset time is: 2026-07-25 08:13:36