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.

Dark GDK / Terrain and not going up hills.

Author
Message
j911g
8
Years of Service
User Offline
Joined: 27th Jan 2012
Location:
Posted: 5th Mar 2012 21:37
Hello all, I'm new to dark basic and I was wondering if anyone had some ideas for a program I'm going to make.

Basically I've got a height map that I've constructed into a maze.

The camera is set to always follow along the ground and be controleld using the arrow keys, but I don't want it to be able to go over the walls.

Any ideas on how I could get this to work? I would appreciate any help. I searched for similar problems but couldn't find any.
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 5th Mar 2012 22:26
Your camera will be following an avatar or is it first person? Either way, you can do a check as the character is going forward. If the elevation difference is greater than your threshold, then don't move forward. Take it a bit further and check the x and z components seperately. If that component is not colliding (making it go past the elevation difference threshold), then use that component to change the location.

Are you working with GDK or DBP?

The fastest code is the code never written.
j911g
8
Years of Service
User Offline
Joined: 27th Jan 2012
Location:
Posted: 5th Mar 2012 22:45
It's first person and I'm working with GDK.

How would I stop it from just moving forward if I'm using the dbControlCameraUsingArrowKeys function?

With collision I run into the problem that the collision box on a height map is not well defined, so I end up almost always colliding.

And thank you for the reply!
Hawkblood
10
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 6th Mar 2012 02:07
Don't use dbControlCameraUsingArrowKeys. Move the camera manually. That way you have better control. Also, don't use collision box. Use dbGetTerrainGroundHeight. (I assume you are using GDK's terrain). I also assume you already have a "mouse look" function.?

The fastest code is the code never written.
j911g
8
Years of Service
User Offline
Joined: 27th Jan 2012
Location:
Posted: 6th Mar 2012 02:43
I did make a mouse look function, and was able to get it working using the terrain height rather than collision. Thank you for the replies Hawkblood, I appreciate the help!

Login to post a reply

Server time is: 2020-09-18 12:21:48
Your offset time is: 2020-09-18 12:21:48