November 25, 2020, 07:54:24 AM

Author Topic: Blitz NG - Camera Problem  (Read 130 times)

Offline Lucky_Strikez

  • Jr. Member
  • **
  • Posts: 6
Blitz NG - Camera Problem
« on: October 03, 2020, 11:58:14 AM »
Hi all, I'm trying to use this old camera code from 2003 and it works, but it doesn't point at the entity center. I'm just posting this as a bug report I guess, not sure where else to put it. It works correctly in regular old Blitz3d but not quite right in Blitz3d NG, the camera points to the left of the entity. You can paste it directly and run it to test it out, what you think about this Rontek?:

Code:  (Unknown Language)
  1. ; SuperCam!
  2. ;
  3. ; by PsychicParrot 2003
  4. ;
  5. ;
  6. ; Usage : SuperCam(cam,ent,cspeed#,dist#,hite#,xrot#,tilt#)
  7. ;
  8. ;
  9.  
  10. Graphics3D 640,480,16,3
  11. SetBuffer=BackBuffer()
  12.  
  13. Global campivot=CreateCube() ; create pivot for camera
  14. Global camera=CreateCamera()  ; create camera (!!!)
  15.  
  16. ; ---------------------- THIS IS ALL JUST TO POPULATE THE WORLD WITH SOME RUBBISH ---------------
  17.  
  18. Global light=CreateLight()
  19. Global player=CreateCube()    ; create simple player
  20. Global plane=CreatePlane()   ; create simple floor
  21. MoveEntity player,0,1,0
  22. ; Create texture of size 256x256
  23. tex=CreateTexture(256,256)
  24.  
  25. ; Set buffer - texture buffer
  26. SetBuffer TextureBuffer(tex)
  27.  
  28. ; Clear texture buffer with background white color
  29. For i=1 To 10
  30. Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
  31. Rect Rnd(0,256),Rnd(0,256),Rnd(0,256),Rnd(0,256)
  32. Next
  33.  
  34. ; Texture cube with texture
  35. EntityTexture plane,tex
  36. EntityTexture player,tex
  37.  
  38. ; Set buffer - backbuffer
  39. SetBuffer BackBuffer()
  40.  
  41. ; ----------------------------------------------------------------------------------------------
  42.  
  43. While Not KeyHit(1)
  44.  
  45. If KeyDown(200) Then
  46.         MoveEntity player,0,0,.2
  47. End If
  48.  
  49. If KeyDown(203) TurnEntity player,0,1,0
  50. If KeyDown(205) TurnEntity player,0,-1,0
  51.  
  52. SuperCam(camera,player,.02,6,2,12,0)
  53.  
  54. RenderWorld
  55. Flip
  56.  
  57. Wend
  58.  
  59. End
  60.  
  61. Function SuperCam(cam,ent,cspeed#,dist#,height#,xrot#,tilt#)
  62.  
  63. TFormPoint 0,height#,-dist#,ent,0
  64.  
  65. cx#=(TFormedX()-EntityX(cam))*cspeed#
  66. cy#=(TFormedY()-EntityY(cam))*cspeed#
  67. cz#=(TFormedZ()-EntityZ(cam))*cspeed#
  68.  
  69. TranslateEntity cam,cx,cy,cz
  70. PointEntity cam,ent
  71. RotateEntity cam,xrot#,EntityYaw(cam),tilt#
  72.  
  73. End Function
  74.  
  75.  

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal