Camera Projection Help
Blitz3D Forums/Blitz3D Programming/Camera Projection Help
| ||
Graphics3D 800,600
SetBuffer BackBuffer()
pivot=CreatePivot()
PositionEntity pivot,0,0,0
camera=CreateCamera(pivot)
CameraRange camera,0.1,1000
CameraZoom camera,0.01;.4
PositionEntity camera,0,15,-15
RotateEntity camera,45,0,0
CameraProjMode camera,2
light=CreateLight(1)
PositionEntity light,0,0,-500
AmbientLight 150,150,150
Global tank=CreateCube()
PositionEntity tank,0,-15,0
;EntityType tank, TANKA
ScaleMesh tank,0.10,2,0.10
terrain=CreateCube();LoadMesh("C:\My Documents\Models\25x25 Texture.3DS")
ScaleEntity terrain,5,0.001,5
;EntityFX terrain,34
While Not KeyDown(1)
TurnEntity pivot,0,0.1,0
x=x-MouseXSpeed()
y=y+MouseYSpeed()
MoveMouse 400,300
If x=>800 Then x=799
If x<0 Then x=0
If y=>600 Then y=599
If y<0 Then y=0
MoveEntity tank,0,0.1,0
MoveEntity terrain,0,-0.01,0
UpdateWorld
RenderWorld
Flip
If KeyDown (57) Then Delay 500
Wend
Why in the orthographic projection mode does it not look like the cube called "tank" not look like it is passing through the ground as it clearly does on the perspective view? |
| ||
| Cant test your code yet- but i guess its to do with orthographic camera mode disabling perspective. |
| ||
| I don't think it should behave in the way it does, although there is no perspective if an object is infront of another as it is the second it passes up through the ground it should be visible. |
| ||
| I had similar trouble with using ortho view (z order issue I think) so just did as others (can't recall who) have suggested a few times - set a much bigger camera range, position your objects far away from the camera and use a high camerazoom - it gives the appearance of an ortho camera. |
| ||
| yeah I already did that myself, shame about the orthographic camera mode not working though. |
| ||
| I heard there was an alternative way of disabling the z/w when rendering, setting some parameters to false somewhere.... Does this make sense/any use to anyone at all??? *must learn to explain myself better* |
| ||
| I happen to be playing with orthographic picks right now, and it isn't working so well. It seems that the routine isn't written to account for the camera zoom? |
| ||
| Wrong thread. |
| ||
| lol, mibby a wee edit would be nice ;) |
| ||
| Here ya go. I happened to be working on it at the same time: Function OrthoPick%(cam%,mx#,my#,zoom#) w#=graphicswidth() h#=graphicsheight() zoom=zoom/Float(w-4) mx=(mx-(w/2.0))/Float(w/2.0) my=-(my-(h/2.0))/Float(w/2.0) mx=mx/zoom my=my/zoom TFormPoint mx,my,0,cam,0 x0=TFormedX() y0=TFormedY() z0=TFormedZ() m#=100000 TFormVector 0,0,m,cam,0 Return LinePick(x0,y0,z0,TFormedX(),TFormedY(),TFormedZ()) End Function |