Try this:
The entity should rest at the same point all the time. Try not to put slopes in ;o) It should handle them ok actually.
The entity should rest at the same point all the time. Try not to put slopes in ;o) It should handle them ok actually.
Graphics3D 800,600,16,2 Const c_jumpspeed# = .3 Const c_gravity# = -.016 Global g_game_gravity# = 0 Global g_game_player_jumpspeed# = 0 ground = CreateCube() ScaleEntity ground, 2,1,2 EntityColor ground, 0,0,255 EntityType ground, 1 EntityPickMode ground, 2 ground1 = CreateCube() ScaleEntity ground1, 2,1,2 EntityColor ground, 0,0,255 EntityType ground, 1 EntityPickMode ground1, 2 PositionEntity ground1, -4, -4, 0 EntityColor ground, 0,255,0 player = CreateSphere() PositionEntity player, 0,2,0 EntityColor player, 255,0,0 EntityType player, 2 light=CreateLight() PositionEntity light, 0, 3, -7 TurnEntity light,45,45,0 cam = CreateCamera() PositionEntity cam, -3, 3, -15 PointEntity cam, player CameraZoom cam,1.6 Global pick_length# = 1.1 ; slightly larger than the entityraduis While Not KeyHit(1) If KeyDown(203) MoveEntity player,-.1,0,0 If KeyDown(205) MoveEntity player,.1,0,0 If KeyDown(200) MoveEntity player,0,0,.1 If KeyDown(208) MoveEntity player,-0,0,-.1 If KeyHit(30) g_game_player_jumpspeed# = c_jumpspeed# g_game_gravity# = c_gravity# EndIf ;DebugLog "jumping = " + g_game_player_jumpspeed# g_game_player_jumpspeed# = g_game_player_jumpspeed# + g_game_gravity# TranslateEntity player,0, g_game_player_jumpspeed#,0 If LinePick(EntityX#(player), EntityY#(player), EntityZ#(player), 0, -pick_length, 0) > 0 g_game_player_jumpspeed# =0 g_game_gravity# = 0 PositionEntity player,EntityX#(player,True),PickedY()+pick_length,EntityZ(player,True),True Else g_game_gravity# = c_gravity# EndIf UpdateWorld RenderWorld Text 10,10, "player position " + EntityX#(player) + " " + EntityY#(player) + " " + EntityZ#(player) Text 10,30, "linepick " + LinePick(EntityX#(player), EntityY#(player), EntityZ#(player), 0, -2, 0) Text 10,50, "distance " + EntityDistance#(player, ground) Flip Wend