This is really very noob question
I must have missed something really simple, but - why is this sphere flying up? I thought that it should stand still or, at most, fall down to the plane. Why doesn't it stop at the upper plane, but after some jerks continues going upward?
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Ustronie - PG2" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
setCameraRange(1,15,60000)
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
teren1=createobjectplane(2000,2000)
setobjectrotation(teren1,90,0,0)
SetObjectLightMode(teren1,1)
setobjectposition(teren1,-200,0,5000)
teren2=createobjectplane(2000,2000)
setobjectrotation(teren2,90,0,0)
SetObjectLightMode(teren2,1)
setobjectposition(teren2,-200,500,5000)
SetSkyBoxHorizonColor( 60,6,6 )
SetSkyBoxSkyColor( 3, 3, 40 )
SetSkyBoxVisible(1)
SetAmbientColor( 20,20,20 ) `tu jest oświetlenie całości; 0,0,0 wyłącza
SetSunDirection (-1,-1,0)
SetSunColor(40,30,50)
SetSunActive (1)
someSphere=createobjectsphere(20,12,12)
SetObjectPosition(someSphere, -375, 10, 5051)
setobjectscale (someSphere,0.3,0.3,0.3)
do
rem Old position
oldx#=GetObjectX(someSphere)
oldy#=GetObjectY(someSphere)
oldz#=GetObjectZ(someSphere)
// set camera on your character
SetCameraPosition(1, GetObjectX(someSphere),GetObjectY(someSphere),GetObjectZ(someSphere))
//align camera rotation with character POV
SetCameraRotation( 1, 0,GetObjectAngleY(someSphere)-180 , 0)
//move the camera behind you
MoveCameraLocalZ(1, -80)
//move the camera up
MoveCameraLocalY( 1, 35 )
`
rem New position
newx#=GetObjectX(someSphere)
newy#=GetObjectY(someSphere)
newz#=GetObjectZ(someSphere)
if ObjectSphereSlide(0,oldx#,oldy#,oldz#,newx#,newy#,newz#,10)>0
newx#=GetObjectRayCastSlideX(0)
newy#=GetObjectRayCastSlideY(0)
newz#=GetObjectRayCastSlideZ(0)
SetObjectPosition(someSphere,newx#,newy#, newz#)
endif
Print( ScreenFPS() )
printc ("x=")
print(GetObjectX(someSphere))
printc("z=")
print (GetObjectZ(someSphere))
printc ("y=")
print (GetObjectY(someSphere))
Sync()
loop