Exactly, smallg.
DavidAGK,
That is my exact approach I am doing now. I test the current position, then I test where the player will move to(with a slight increase due to FPS). The player's speed is then adjusted by the slope to eventually a speed of zero. Then I take the players "would be" position and find the y-coord via raycast.
elseif standingOnObjectTest = 0 and groundtest = 0
speedx# = character_x_movement#*3
speedz# = character_z_movement#*3
//slope test
//walkablehit = ObjectSphereCast( home_grd, GetObjectX( objID ), 100, GetObjectZ( ObjID ), GetObjectX( objID )+speedx#, -10.0, GetObjectZ( ObjID )+speedz#, .05 )
walkablehit = ObjectRayCast( home_grd, GetObjectX( objID )+speedx#, 100.0, GetObjectZ( ObjID )+speedz#, GetObjectX( objID )+speedx#, -100.0, GetObjectZ( ObjID )+speedz# )
yh#= GetObjectraycastY( 0 )
slope# = abs(yh# - GetObjectY(ObjID) )
slopeCutoff# = .06
print(slope#)
speed_adjustment# = 1.0-( slope#/slopeCutoff# )
if speed_adjustment# < 0 then speed_adjustment# = 0
if speed_adjustment# > 1 then speed_adjustment# = 1
character_x_movement# = character_x_movement#*speed_adjustment#
character_z_movement# = character_z_movement#*speed_adjustment#
groundtest = ObjectRayCast( home_grd, GetObjectX( objID )+character_x_movement#, 30.0, GetObjectZ( ObjID )+character_z_movement#, GetObjectX( objID )+character_x_movement#, -1000.0, GetObjectZ( ObjID )+character_z_movement# )
yh# = GetObjectraycastY( 0 )
if yh# < -.45
character_x_movement# = 0
character_z_movement# = 0
yh# = GetObjectY( objID )
endif
endif
endif
SetObjectPosition( objID, GetObjectX( objID )+character_x_movement#, yh#, GetObjectZ( objID )+character_z_movement# )
But, in some areas the player can find their way up, if they are persistent enough. Hopefully, that makes sense?