Exact but what if the entity is off screen ? it will not return what I am looking for.
But ok, I think I am on the good way now, here what I've got:
Graphics3D 640,480
SetBuffer BackBuffer()
CamDistance# = 10
CamFocus# = 1
camera=CreateCamera()
light=CreateLight()
control=CreateSphere( 32 )
ScaleEntity control,0.1,0.1,0.1
TL=CreateSphere( 32 )
TR=CreateSphere( 32 )
BL=CreateSphere( 32 )
BR=CreateSphere( 32 )
While Not KeyDown( 1 )
x#=0 : y#=0 : z#=0
If KeyDown( 203 )=True Then x#=-0.1
If KeyDown( 205 )=True Then x#=0.1
If KeyDown( 208 )=True Then y#=-0.1
If KeyDown( 200 )=True Then y#=0.1
If KeyDown( 44 )=True Then z#=-0.1
If KeyDown( 30 )=True Then z#=0.1
If KeyDown( 56 )=True Then : x#=x#/2 : y#=y#/2 : z#=z#/2 : End If
MoveEntity control,x#,y#,z#
If KeyDown( 74 )=True Then CamDistance# = CamDistance# + 1
If KeyDown( 78 )=True Then CamDistance# = CamDistance# - 1
If KeyDown( 26 )=True Then CamFocus# = CamFocus# + .01
If KeyDown( 27 )=True Then CamFocus# = CamFocus# - .01
CameraZoom camera,CamFocus#
PositionEntity camera,0,0,-CamDistance#
LimitW# = CamDistance# / CamFocus#
LimitH# = LimitW# / 1.33
PositionEntity TL,-LimitW#,LimitH#,0
PositionEntity TR,LimitW#,LimitH#,0
PositionEntity BL,-LimitW#,-LimitH#,0
PositionEntity BR,LimitW#,-LimitH#,0
RenderWorld
Text 0,20,"controlX: "+EntityX#(control,1)
Text 0,40,"controlY: "+EntityY#(control,1)
Text 0,60,"controlZ: "+EntityZ#(control,1)
Flip
Wend
End
But ok, I think I am on the good way now, here what I've got:
Graphics3D 640,480
SetBuffer BackBuffer()
CamDistance# = 10
CamFocus# = 1
camera=CreateCamera()
light=CreateLight()
control=CreateSphere( 32 )
ScaleEntity control,0.1,0.1,0.1
TL=CreateSphere( 32 )
TR=CreateSphere( 32 )
BL=CreateSphere( 32 )
BR=CreateSphere( 32 )
While Not KeyDown( 1 )
x#=0 : y#=0 : z#=0
If KeyDown( 203 )=True Then x#=-0.1
If KeyDown( 205 )=True Then x#=0.1
If KeyDown( 208 )=True Then y#=-0.1
If KeyDown( 200 )=True Then y#=0.1
If KeyDown( 44 )=True Then z#=-0.1
If KeyDown( 30 )=True Then z#=0.1
If KeyDown( 56 )=True Then : x#=x#/2 : y#=y#/2 : z#=z#/2 : End If
MoveEntity control,x#,y#,z#
If KeyDown( 74 )=True Then CamDistance# = CamDistance# + 1
If KeyDown( 78 )=True Then CamDistance# = CamDistance# - 1
If KeyDown( 26 )=True Then CamFocus# = CamFocus# + .01
If KeyDown( 27 )=True Then CamFocus# = CamFocus# - .01
CameraZoom camera,CamFocus#
PositionEntity camera,0,0,-CamDistance#
LimitW# = CamDistance# / CamFocus#
LimitH# = LimitW# / 1.33
PositionEntity TL,-LimitW#,LimitH#,0
PositionEntity TR,LimitW#,LimitH#,0
PositionEntity BL,-LimitW#,-LimitH#,0
PositionEntity BR,LimitW#,-LimitH#,0
RenderWorld
Text 0,20,"controlX: "+EntityX#(control,1)
Text 0,40,"controlY: "+EntityY#(control,1)
Text 0,60,"controlZ: "+EntityZ#(control,1)
Flip
Wend
End