Rotate Camera
Blitz3D Forums/Blitz3D Programming/Rotate Camera
| ||
Need help guys.. How do I rotate a camerra using cetern object axis. This picture illustrate what I mean. Thanks for help. |
| ||
parent the camera to the object (or to a pivot at the object's centre) then always point it at the object and move it to the new position |
| ||
Thanks Perturbatio, what a huge speed of respon (less than 7 second). I love blitz forum. Its A LIVE!! |
| ||
Graphics3D 640,480 ; brushes brush1=CreateBrush() BrushColor brush1,255,0,0 brush2=CreateBrush() BrushColor brush2,0,255,0 brush3=CreateBrush() BrushColor brush3,0,0,255 SetBuffer BackBuffer() player_pivot=CreatePivot() camera=CreateCamera() light=CreateLight() plane=CreatePlane() cube=CreateCube(player_pivot ) cone=CreateCone() PaintEntity cube,brush1 PaintEntity cone,brush2 PaintEntity plane,brush3 PositionEntity player_pivot,0.0,1.0,0.0 PositionEntity cone,-5.0,1.0,0.0 dist#=10.0 ; distance from center to camera SetBuffer BackBuffer() While Not KeyDown( 1 ) ; Change position values depending on key pressed If KeyDown( 203 )=True Then cam_angle#=cam_angle#-0.1 If KeyDown( 205 )=True Then cam_angle#=cam_angle#+0.1 PositionEntity camera,EntityX(player_pivot)+Cos(cam_angle#)*dist#,EntityY(player_pivot),EntityZ(player_pivot)+Sin(cam_angle#)*dist# RotateEntity camera,0.0,cam_angle#+90.0,0.0 RenderWorld Text 0,10,"cameraangle: "+cam_angle# Text 0,30,"X: "+EntityX(camera) Text 0,40,"Y: "+EntityY(camera) Text 0,50,"Z: "+EntityZ(camera) Flip Wend End Damn... I was hoping I could be the first with a small proggy... Andy |