Wow Bengismo !! you did it !! .... changing just two stupid lines awesome you are an axe !! Thanks so much ...that was somehow driving crazy ...I always thought it was an easy task .
Edit.
Here's is an example of what I'm trying to do...just a AABB sliding collision for my retro Dungeon to hell.
// Project: AABB SLIDING COLLISION by Bengismo)
// Created: 2019-01-28
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "AABB SLIDING COLLISON" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 800, 600 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
r=makecolor(100,100,100)
drawbox(0,0,64,128,r,r,r,r,1)
g=makecolor(70,70,70)
drawbox(64,0,128,128,g,g,g,g,1)
getimage(1,0,0,128,128)
SetImageWrapU(1,1)
SetImageWrapV(1,1)
createobjectbox(1,3,1,3)
SetObjectVisible(1,0)
createobjectbox(20,20,5,6)
setobjectimage(20,1,0)
setobjectposition(20,0,0,50)
createobjectbox(21,30,5,2)
setobjectimage(21,1,0)
setobjectposition(21,-20,0,20)
createobjectbox(22,15,5,10)
setobjectimage(22,1,0)
setobjectposition(22,5,0,35)
createobjectbox(23,5,5,30)
setobjectposition(23,-20,0,50)
cloneobject(24,23)
setobjectposition(24,-30,0,50)
createobjectbox(100,300,1,300)
setobjectposition(100,0,-2,0)
setobjectimage(100,1,0)
SetObjectUVScale(100,0,10,1)
createobjectbox(30,2,2,0.5)
setobjectcolor(30,255,0,0,0)
setcamerarange(1,0.1,2000)
setcameraposition(1,0,70,30)
SetCameraLookAt(1,0,0,30,0)
SetObjectVisible(30,0)
for i= 20 to 24
setobjectimage(i,1,0)
SetObjectUVScale(i,0,10,1)
next
tn#=90
SetSunActive(0)
SetAmbientColor(0,0,0)
createpointlight(1,0,0,0,50,255,255,0)
do
`guardar vieja z
oldx#=x#
oldz#=z#
if ( GetRawKeyState( 38 ) )
x#=x#+(cos(tn#))*0.3
z#=z#+(sin(tn#))*0.3
endif
if ( GetRawKeyState( 40) )
x#=x#+(cos(tn#))*-0.3
z#=z#+(sin(tn#))*-0.3
endif
setobjectposition(1,x#,0,z#)
setobjectposition(30,x#,0,z#)
if ( GetRawKeyState( 37)) then tn#=tn#+5
if ( GetRawKeyState( 39)) then tn#=tn#-5
maxz1#=GetObjectMeshSizeMaxZ(1,1)
minz1#=GetObjectMeshSizeMinZ(1,1)
maxx1#=GetObjectMeshSizeMaxx(1,1)
minx1#=GetObjectMeshSizeMinx(1,1)
for t= 20 to 24
maxz2#=GetObjectMeshSizeMaxZ(t,1)
minz2#=GetObjectMeshSizeMinZ(t,1)
maxx2#=GetObjectMeshSizeMaxx(t,1)
minx2#=GetObjectMeshSizeMinx(t,1)
z1#=getobjectz(1)
x1#=getobjectx(1)
z2#=getobjectz(t)
x2#=getobjectx(t)
if z#+maxz1#>z2#+minz2# and oldx#+maxx1#>x2#+minx2# and oldx#+minx1# <x2#+maxx2# and z#+minz1#<z2#+maxz2#
z#=oldz#
endif
if oldz#+maxz1#>z2#+minz2# and x#+maxx1#>x2#+minx2# and x#+minx1# <x2#+maxx2# and oldz#+minz1#<z2#+maxz2#
x#=oldx#
endif
next
setcameraposition(1,getobjectx(30),getobjecty(30)+1,getobjectz(30))
setcamerarotation(1,0,GetObjectAngleY(30)+90,0)
setpointlightposition(1,getcamerax(1),2,getcameraz(1))
setobjectrotation(30,0,-tn#,0)
Sync()
loop
I'm not a grumpy grandpa