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.

Newcomers DBPro Corner / Following the curve of a .x terrain?

Author
Message
Kieran
18
Years of Service
User Offline
Joined: 6th Aug 2006
Location: Hamilton, New Zealand
Posted: 15th Apr 2010 05:00
Ok well currently I have a terrain, which has a scorpion. The scorpion walks over it at the correct height as found using this equation:



However, at certain points parts of the scorpion go through the ground as the scorpion is always horizontal. I am wondering how I can find the angle I need to position the scorpion at using raycasting or such on the terrain.
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 15th Apr 2010 12:31 Edited at: 16th Apr 2010 15:39
there used to be a tutorial called limit rush or somethign by binary moon on the website, but I don't know where it has gone with the new update (still looking around)

it used a matrix rather than adv terrain but it could be adapted pretty easily. If you are using a terrain mesh rather than an adv terrain it should be pretty easy to adapt.

This is what I used to determine pitch and roll of my tank across an advanced terrain:



basically this code checks the terrain height at 4 positions around the tank (fron, back, left, right, at 1 unit displaced from the mesh origin) if you are using a mesh object rather than heightmap or memblock terrain, you could use raycasting rather than get terrain ground height to get the 4 height values

then the height difference is turned into a pitch (xang#) and bank (zang#) variable

This is not the Sig you are looking for....
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 15th Apr 2010 12:33
HI there.Here is an example to get what you want.If you are using advance terrain, you have to change get ground height for get terrain ground height

I hope it can help to you.

Cheers.




I'm not a grumpy grandpa
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 16th Apr 2010 23:55
You could cast another ray right in front of the scorpion, and then point the scorpion object at the second collision point. This wouldn't be perfect, but it would be better.

Login to post a reply

Server time is: 2024-09-28 16:29:07
Your offset time is: 2024-09-28 16:29:07