quickie:
// Project: TerrainHeight
// Created: 2021-12-12
// By: Virtual Nomad
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "TerrainHeight" )
SetWindowSize( 1280,720, 0 )
SetWindowAllowResize( 1 )
MaximizeWindow()
// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 )
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )
terrain = CreateObjectFromHeightMap("YellowStone.png", 512,64,512,4,1)
SetObjectImage(terrain, LoadImage("YellowStone.png"),0 )
SetObjectCollisionMode(terrain,1)
cx# = 256.0 : cz# = 256.0
ray = ObjectRayCast(terrain,cx#,128,cz#,cx#,-16,cz#)
cy# = GetObjectRayCastY(0)
SetCameraPosition(1,cx#,cy#+10,cz#)
do
If GetRawKeyState(27) then Exit
SetCameraRotation(1,0, GetCameraAngleY(1) + GetJoystickX()*2.0,0)
angle# = GetCameraAngleY(1)
if GetJoystickY() <> 0.0
cx# = cx# + SIN(angle#)* -GetJoystickY()*2.0
cz# = cz# + COS(angle#)* -GetJoystickY()*2.0
ray = ObjectRayCast(terrain,cx#,128,cz#,cx#,-16,cz#)
cy# = GetObjectRayCastY(0)
SetCameraPosition(1,cx#,cy#+10,cz#)
Endif
Print("WASD")
Sync()
loop