Hi All
gamergod88 , here is a little demo I have put together as I was having the same problem , took me a while to get my head around collision detection
The demos in BlinkOk's link are very good , but they use the Physic's commands and I did not want to use them
So this is what I came up with , I am no expert on this and could be a better way to do this ?
move the cube/player up and down left and right using ADWS keys , the player will not go through the platform
and will move along and fall off if pressing down when at end of platform
hope this might help you , this does X and Y but does not include the Z 3d aspect
// Project: 3d collision test
// Created: 2016-06-04
// set window properties
SetVirtualResolution(1280,800)
SetWindowSize( 1280, 800, 0 )
SetDisplayAspect(1280 / 800.0)
SetScissor(0,0,0,0)
SetOrientationAllowed( 1, 1, 1, 1 )
SetCameraPosition(1,0,0,-150)
SetCameraLookAt(1,0,0,0,0)
// make player and colour him red
player=1
CreateObjectBox(player,10,10,10)
SetObjectColor(player,255,255,255,100)
SetObjectPosition(player,-90,0,0)
SetObjectCollisionMode(player,0)
SetObjectColor(player,255,0,0,255)
// make platform
platform=2
CreateObjectBox(platform,100,5,30)
SetObjectColor(platform,255,255,255,100)
SetObjectPosition(platform,0,-40,0)
// set the radius of the player at 5 as the player is 10x10x10
radius=5
do
// get player input
joystick_y# = GetJoystickY()*-1
joystick_x# = GetJoystickX()*1
player_x#=player_x#+joystick_x#
player_y#=player_y#+joystick_y#
// save old position
player_oldx# = GetObjectX(player)
player_oldy# = GetObjectY(player)
// check to see if player hits platform
object_hit = ObjectSphereSlide(platform, player_oldx#, player_oldy#,0.0,player_x#, player_y#,0.0,radius)
// if player touches platform , make him stay there
if object_hit <> 0
player_x# = GetObjectRayCastSlideX(player)
player_y# = GetObjectRayCastSlideY(player)
endif
// position the player
SetObjectPosition(player, player_x#, player_y#, 0.0)
sync()
loop
Mick