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

Author
Message
Jonathan Gavilan Mora
6
Years of Service
User Offline
Joined: 12th Sep 2013
Location:
Posted: 15th Sep 2013 00:32
Hello! new doubt.

How I can make a character walk on uneven ground if the ground is. x or. Dbo instead. Dbt.

I do not know if I explained well.

Thank you very much!

Caza
Rudolpho
13
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 15th Sep 2013 12:25
Use ray casting to determine the height of the terrain (or any other mesh) and position the character accordingly.
dbIntersectObject(objNumber, x1, y1, z1, x2, y2, z2) will return the distance from (x1, y1, z1) at which the object objNumber intersects with the ray (a line, simply enough) from (x1, y1, z1) to (x2, y2, z2), or 0 if the object doesn't intersect at all.
Therefore you can do something like this to get ground height:



"Why do programmers get Halloween and Christmas mixed up?"
Jonathan Gavilan Mora
6
Years of Service
User Offline
Joined: 12th Sep 2013
Location:
Posted: 15th Sep 2013 17:46
Thank you so much!

It works perfect!

Caza
Jonathan Gavilan Mora
6
Years of Service
User Offline
Joined: 12th Sep 2013
Location:
Posted: 24th Sep 2013 11:00
Hello! I have another question regarding the role of which we have spoken before ... If I create a field with trees, houses, etc. ..
when the character reaches a tree for example, slammed into the or have some kind of problem?

Thanks and sorry for my English

Caza
Rudolpho
13
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 13th Oct 2013 20:57
Like a collision system you mean?
Or if the raycasting will fail because the tree is in the way?
In the second case, no, it will only consider the terrain with the solution given above. If you need to raycast against multiple objects a collision library would probably be the easiest solution since those tend to offer that functionality out of the box.


"Why do programmers get Halloween and Christmas mixed up?"

Login to post a reply

Server time is: 2019-09-22 02:43:04
Your offset time is: 2019-09-22 02:43:04