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 / Help with landscape tiling

Author
Message
ZioNz
22
Years of Service
User Offline
Joined: 4th Sep 2003
Location:
Posted: 14th Nov 2003 05:07
Hi all, im trying to make a game in wich you have to drive some vehicles, the problem i have is i can't make the vehicle to be affected by the terrain elevations correctly. I already read a DB clasic tutorial about this (Binary moon tutorial i think) but it didn't worked to me. I attached the full code im using.Any help would be appreciated. Sry for my bad english but im spanish.

-
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 14th Nov 2003 11:49
Yeah, I always had trouble doing that too, so I cheated.

I had a dummy limb at each side of the model, like one the floor directly in front, behind, and at the sides. Then I use a dummy object and position it at the limb on the back of the model, then point it at the front, then store the Z angle - then do the same with the left and right limbs and store the Z angle again, but it's really the X angle of the vehicle your storing.

The trick is to use a dummy object for the vehicles positioning and Y rotating - with the vehicle model glued to it. That will let you have full rotation control. You'd rotate the dummy model on the Y axis, and after using SET OBJECT ROTATION ZYX on the vehicle, you can rotate it on the stored X and Z angles, leaving the Y rotation at 0.

I used this method in Stoked, so if you want to see it in more detail you can download it from my website with the full source code.


Van-B


I laugh in the face of fate!
Beta 1
22
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 14th Nov 2003 13:14
I think I did a similar thing to get around the rotation issue.

I use a hidden mesh as the model and the real mesh as limb 1 (unhidden) then you y rotate the whole object but rotate limb1 on the x/z axis to make it match the terrain.
ZioNz
22
Years of Service
User Offline
Joined: 4th Sep 2003
Location:
Posted: 14th Nov 2003 23:44
Hi, thanks for the help, i tryed your idea Van B, but without using limbs ( i dont understand them), it didn't worked. I tryed using this sub:

posplayer:
distVal#=20

yAng#=object angle y(1)
xPos#=object position x(1)
zPos#=object position z(1)

ang#=yAng#
frontX#=newxvalue(xPos#,ang#,distVal#)
frontZ#=newzvalue(zPos#,ang#,distVal#)

ang#=wrapvalue(yAng#+180)
backX#=newxvalue(xPos#,ang#,distVal#)
backZ#=newzvalue(zPos#,yang#,distVal#)

ang#=wrapvalue(yAng#-90)
leftX#=newxvalue(xPos#,ang#,distVal#)
leftZ#=newzvalue(zPos#,ang#,distVal#)

ang#=wrapvalue(yAng#+90)
rightX#=newxvalue(xPos#,ang#,distVal#)
rightZ#=newzvalue(zPos#,ang#,distVal#)


frontH#=get ground height(1,frontX#,frontZ#)
backH#=get ground height(1,backX#,backZ#)

leftH#=get ground height(1,leftX#,leftZ#)
rightH#=get ground height(1,rightX#,rightZ#)


position object 2,frontX#,frontH#,frontZ#
point object 2,backX#,backH#,backZ#
position object 3,rightX#,rightH#,rightZ#
point object 3,leftX#,leftH#,leftZ#


zrotate object 1,object angle x(2)
xrotate object 1,object angle x(3)
return

-

Login to post a reply

Server time is: 2026-07-26 14:31:04
Your offset time is: 2026-07-26 14:31:04