why is this happening, player motion related issue?

Blitz3D Forums/Blitz3D Beginners Area/why is this happening, player motion related issue?

NRJ(Posted 2016) [#1]
I have made a first person player control using the cubewater.bb example, in my program I have loaded the wall model as shown in Figure below., when the player reaches the wall and looks down, then the upper part of the wall gets cutted as shown in the figure below. 


The code I am using is written below. 
What I do to correct that issue ? 1 





 


 

Global mvx#,mvz# 
Graphics3D 800,600 

type_ground=1 
type_character=2 
type_scenery=3 

SetBuffer BackBuffer() 

player=CreatePivot() 
EntityType player,type_character 
PositionEntity player,0,4,0 
EntityRadius player,1.5,0.5 

camera=CreateCamera(player) 
PositionEntity camera,0,1,0 

pl=CreatePlane() 
PositionEntity pl,0,-1,0 

pl_tex=LoadTexture( "E:\textures\marble.jpg" ) 
ScaleTexture pl_tex,5,5 
EntityTexture pl,pl_tex 
EntityType pl,type_ground 

wall=LoadMesh("E:\wings3d\test_wall.3ds") 
PositionMesh wall,0,-1,20 
EntityType wall,type_scenery 

Collisions type_character,type_ground,2,2 
Collisions type_character,type_scenery,2,2 

HidePointer() 

While Not KeyHit( 1 ) 

TranslateEntity player,0,-.2,0 

 mxspd#=MouseXSpeed()*0.25 
 myspd#=MouseYSpeed()*0.25 

 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 

 campitch=campitch+myspd 
 If campitch<-75 Then campitch=-75 
 If campitch>75 Then campitch=75 

 RotateEntity player,campitch,EntityYaw(player)-mxspd,0 

  
 If KeyDown(203) Then mvx=mvx-.02 
 If KeyDown(205) Then mvx=mvx+.02 
 If KeyDown(200) Then mvz=mvz+.02 
 If KeyDown(208) Then mvz=mvz-.02
  

 mvx=mvx/1.2 
 mvy=mvy/1.2 
 mvz=mvz/1.2 

 
MoveEntity player,mvx,0,mvz 

UpdateWorld 
RenderWorld 
Flip 

Wend 
End 




RustyKristi(Posted 2016) [#2]
Try tweaking your player entity radius since your camera is parented to it or maybe change the entity radius of camera

EntityRadius player,1.5,0.5


NRJ(Posted 2016) [#3]
I don't want to increase the entity radius of the player, if I increase the player entity radius then the player is unable to go between the walls, the way between the walls is 3 units wide and 6 units of height. This problem does not not occur when I change the entityradius  player, 2.5, 0.5. 

If I apply this,then I need to make huge size model's, it disrupts the height and width ratios of my model. 


RustyKristi(Posted 2016) [#4]
yes as I have said lastly change the camera entity radius..


RemiD(Posted 2016) [#5]
Try to decrease the min value of the CameraRange, for example :
CameraRange(Camera,0.1,100)


Zethrax(Posted 2016) [#6]
Avoid making the near value any lower than you have to though. The resolution of the depth buffer apparently increases dramatically the nearer things are rendered relative to the camera. I forget the specifics of it, but basically try to tweak the near value to remove the clipping issue without making the value too low.


NRJ(Posted 2016) [#7]
@Remid

I have fixed the 
camerarange camera,0.1,1000
it  works when

Entityradius player, 1.2,0.5

Positionentity camera, 0,1,0

As the camera is only 1 unit above the ground, when I position the camera to a higher position to

Positionentity camera, 0,2,0

the problem again occurs, now what I need to fix it. 


RemiD(Posted 2016) [#8]
Your "character controller" may be buggy, you need to forbid the camera to go too near the faces of a mesh, with a camerarange with a minimum value of 0.1, the camera must always be at a distance greater than 0.1 from the faces .