ok this kinda goes with my post in blitz3d newbies forum but i am not getting many more answers on there so made new post. ok well i got my collisions working right with the floor and stuff exept for the corners. when i jump into a corner and hold the foward(or any other direction depends on which way looking), i literaly stick to the corner. or if i hold foward before i jump i won't be able to jump at all. so i was wondering if anybody could help me out with this? here is my code
EDIT: oh and also i kinda bounce down ramps. only down them. so if you feel like it you can look at that too but you don't have to.
thanks, Rubiks14
; set up the graphics Graphics3D 640,480 ;set up the back buffer SetBuffer BackBuffer() ; some globals Global PlayerGrav# = 0.0 Global Grav# = 0.2 Global jumped = 0 ; collision groups Global PLAYER = 1 Global SCENERY = 2 Global type_ladders = 3 ; create a light AmbientLight 255,255,255 ; create a pivot for the camera Global camera_pivot = CreatePivot() ; give a radius to the pivot EntityRadius camera_pivot,7.5 ; make a type for the piivot EntityType camera_pivot,PLAYER ; move the player to the middle of the map PositionEntity camera_pivot,100,100,100 ; create a camera Global camera = CreateCamera() ; give the camera a distance CameraRange camera,1,600 EntityType camera,PLAYER ; load the level Global level = LoadMesh("test.b3d") ScaleEntity level,15,15,15 EntityType level,SCENERY ; load the gun mesh Global gun = LoadMesh("gloc.3ds",camera) ; load the gun texture weapon_tex2 = LoadTexture("glocmap.jpg") ; texture the gun EntityTexture gun,weapon_tex2 ; rotate the gun RotateEntity gun,12,170,14 ; scale the gun ScaleEntity gun,0.01,0.01,0.01 ; position the gun a little behind the camera PositionEntity gun,1,-1,1.5 ; draw the gun last EntityOrder gun, -1 ; collisions Collisions PLAYER,SCENERY,2,3 Global my_time = CreateTimer(40) Global old_time = MilliSecs() ; main loop While Not KeyHit(1) PositionEntity camera, EntityX(camera_pivot), EntityY(camera_pivot), EntityZ(camera_pivot) ; the player is moving down PlayerGrav# = PlayerGrav# - Grav# ; move the camera to current gravity force TranslateEntity camera_pivot,0,PlayerGrav#,0 ; give gravity to the level For c = 1 To CountCollisions(camera_pivot) If CollisionNY(camera_pivot,c) > 0 PlayerGrav# = 0.0 jumped = 0 ; if player hits the ceiling when jumping come back down If CollisionNY(camera_pivot,c) < 0 And jumped = 1 PlayerGrav# = PlayerGrav - Grav# EndIf EndIf Next MovePlayer() TurnPlayer() ; update the world UpdateWorld WaitTimer(my_time) ; draw the world RenderWorld ; FPS frames=frames+1 If MilliSecs()-render_time=>1000 Then fps=frames : frames=0 : render_time=MilliSecs() Text 0,0,fps ; flip the buffers Flip ; end of main loop Wend ; end of program End Function MovePlayer() ; move the player foward when player presses w If KeyDown(17) Then MoveEntity camera_pivot,0,0,1 ; move the player back when player presses s If KeyDown(31) Then MoveEntity camera_pivot,0,0,-1 ; move the player left when player presses a If KeyDown(30) Then MoveEntity camera_pivot,-1,0,0 ; move the player right when player presses d If KeyDown(32) Then MoveEntity camera_pivot,1,0,0 ; make the player jump if player presses space If KeyDown(57) And jumped = 0 ; make the player jump PlayerGrav# = 2 ; the player has jumped jumped = 1 ; flush the keys FlushKeys EndIf End Function Function TurnPlayer() x_speed#=(MouseXSpeed()-x_speed)/2+x_speed y_speed#=(MouseYSpeed()-y_speed)/2+y_speed TurnEntity camera,y_speed,0,0,0;global false TurnEntity camera_pivot,0,-x_speed,0,1;global true RotateEntity camera_pivot, EntityPitch#(camera_pivot), EntityYaw#(camera_pivot), 0 ;z roll correction RotateEntity camera, EntityPitch#( camera ), EntityYaw#(camera_pivot), 0 ;Z roll correction MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 End Function
EDIT: oh and also i kinda bounce down ramps. only down them. so if you feel like it you can look at that too but you don't have to.
thanks, Rubiks14