*.X Landscape

Blitz3D Forums/Blitz3D Beginners Area/*.X Landscape

dalaware(Posted 2005) [#1]
Hi, People

Hope someone can help. I have created a landscape using Maya exported this in *.X format load it in to Blitz3D as an Entity how do I stop the camera from sinking in to the ground? I all ready know, I could do this using heightmaps and terrain, but using Maya to create the landscape gives me more control over building and modelling the landscape could someone
suggest some code to do this here below is my program.

;Graphics
Graphics3D 1024,768
SetBuffer BackBuffer()

;collision groups
Global PLAYER = 2

;Sunlight
Global light = CreateLight()
RotateEntity light, 90,0,0

;CAMERA PIVOT
camera_pivot= CreatePivot()
EntityRadius camera_pivot,1.4
EntityType camera_pivot,PLAYER

;CAMERA
Global camera = CreateCamera(camera_pivot)

;SKYSPHERE
Global sky = CreateSphere(16,camera_pivot)
FlipMesh sky
ScaleEntity sky,1000,1000,1000
PositionEntity sky, 0,150,0
sky_tex = LoadTexture("sky.bmp")
EntityTexture sky,sky_tex

; Load mesh Ground
Ground=LoadMesh("ground.x")
PositionEntity Ground,0,0,0

;Position the camera
PositionEntity camera_pivot,0,10,120

;Main loop
While Not KeyHit(1)
If KeyDown(200) MoveEntity camera_pivot,0,0,0.3
If KeyDown(208) MoveEntity camera_pivot,0,0,-0.3
If KeyDown(203) TurnEntity camera_pivot,0,2,0
If KeyDown(205)TurnEntity camera_pivot,0,-2,0

UpdateWorld


RenderWorld
Flip
Wend

End


Shambler(Posted 2005) [#2]
You can either set up collisions between the camera and the mesh or do what I prefer which is,

make the landscape pickable then do a linepick down from the camera and adjust the camera's Y position based on the value returned by PickedY().

Look up commands EntityPickMode and LinePick and PickedY().