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.

AppGameKit Classic Chat / Finding the height of a object terrain

Author
Message
Game_Code_here
4
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 13th Dec 2021 06:01
So generating terrains is real slow and takes a long time so I am loading them.

But I always fall through them and other stupid stuff.

How can i position my player to stay at the height of the loaded terrain?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Dec 2021 06:57
Game_Code_here
4
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 13th Dec 2021 07:04 Edited at: 13th Dec 2021 07:04
blink0k

It is not a generated height map terrain, it is a loaded one

So that did not work for me.

GetObjectHeightMapHeight
Description
If the object was created with CreateObjectFromHeightMap
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 13th Dec 2021 07:06 Edited at: 13th Dec 2021 07:13
see ObjectRayCast.

i noted a few user examples there, as well.

basically, shoot a ray down from above the terrain object to below the object and use GetObjectRayCastY for your height.

check the "decal" demo, there, which seems to be the most helpful.
Game_Code_here
4
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 13th Dec 2021 07:14
Thanks Virtual Nomad

Ill check that out.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 13th Dec 2021 08:08 Edited at: 13th Dec 2021 08:20
quickie:


Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Dec 2021 13:43
@Virtual Nomad Nice one !
@Game_Code_here you can use Virtual Nomand's example with hight maps ....if you want to go up your own terrain made in 3D Editor, you can use my example basic collision system


Cheers.
I'm not a grumpy grandpa
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 13th Dec 2021 15:46 Edited at: 13th Dec 2021 15:46
and, bullet is also an option.

it depends on all you're trying to do. if it's just getting the "height" of a terrain object, (standard) rays will do the job.
Game_Code_here
4
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 13th Dec 2021 21:17
chafari

I am using physic's and I am good thank you.

Quote: "it depends on all you're trying to do. if it's just getting the "height" of a terrain object, (standard) rays will do the job."


It just do not make any sense.

you give a object collision, it has a static collision set up but the player still falls through it.

But your example works good.

Thank you.

I will show something very soon I am proud of.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 13th Dec 2021 23:31 Edited at: 13th Dec 2021 23:36
@GCH,

ando offered a nice bullet vehicle/terrain demo HERE. you might find some insight.

GCH wrote: "the player still falls through"

in my experience, SetObject3DPhysicsCanSleep() and minimizing/not allowing rotation if there is no linear velocity are key.

i tend to SetObject3DPhysicsLinearVelocity() but i think bullet prefers motors (or other methods where it can determine velocity under the hood) whenever possible. the system seems to be less forgiving than what you (and i) might be used to with box2d, IMHO.

Login to post a reply

Server time is: 2024-11-21 12:59:20
Your offset time is: 2024-11-21 12:59:20