Пятница, 29 Марта 2024, 10:01

Приветствую Вас Гость

[ Новые сообщения · Игроделы · Правила · Поиск ]
  • Страница 1 из 1
  • 1
Форум игроделов » Программирование » Basic » Движение камеры в игре (blitz3d basic)
Движение камеры в игре (blitz3d basic)
denis79513Дата: Четверг, 14 Октября 2010, 11:37 | Сообщение # 1
был не раз
Сейчас нет на сайте
Я имею следующее, машина едек, к ней сверху, сзади прикреплена камера, во время поворота машины она слегда отклоняется в бок, как сделать, чтобы когда отпускаешь клавишу поворота, камера возвращалась в свое положение сама, на место?
RikettaДата: Вторник, 07 Декабря 2010, 13:30 | Сообщение # 2
Strategist
Сейчас нет на сайте
Ковыряй. Код "Гоночки" Там то что тебе нужно.
Code
; SuperCam!

;
; by PsychicParrot 2003
;
;
; Usage : SuperCam(cam,ent,cspeed#,dist#,hite#,xrot#,tilt#)
;
;

Graphics3D 640,480,16,3
SetBuffer=BackBuffer()

Global campivot=CreateCube() ; create pivot for camera
Global camera=CreateCamera()  ; create camera (!!!)

; ---------------------- THIS IS ALL JUST TO POPULATE THE WORLD WITH SOME RUBBISH ---------------

Global light=CreateLight()
Global player=CreateCube()    ; create simple player
Global plane=CreatePlane()   ; create simple floor
MoveEntity player,0,1,0
; Create texture of size 256x256
tex=CreateTexture(256,256)

; Set buffer - texture buffer
SetBuffer TextureBuffer(tex)

; Clear texture buffer with background white color
For i=1 To 10
Color Rnd(0,255),Rnd(0,255),Rnd(0,255)
Rect Rnd(0,256),Rnd(0,256),Rnd(0,256),Rnd(0,256)
Next

; Texture cube with texture
EntityTexture plane,tex
EntityTexture player,tex

; Set buffer - backbuffer
SetBuffer BackBuffer()

; ----------------------------------------------------------------------------------------------

While Not KeyHit(1)

If KeyDown(200) Then
         MoveEntity player,0,0,.2
End If

If KeyDown(203) TurnEntity player,0,1,0
If KeyDown(205) TurnEntity player,0,-1,0

SuperCam(camera,player,.02,8,3,0,2)

RenderWorld
Flip

Wend

End

Function SuperCam(cam,ent,cspeed#,dist#,hite#,xrot#,tilt#)

TFormPoint 0,hite#,-dist#,ent,0

cx#=(TFormedX()-EntityX(cam))*cspeed#
cy#=(TFormedY()-EntityY(cam))*cspeed#
cz#=(TFormedZ()-EntityZ(cam))*cspeed#

T ranslateEntity cam,cx,cy,cz
PointEntity cam,ent
RotateEntity cam,xrot#,EntityYaw(cam),tilt#

End Function


Fougerite - Rust Server OpenSource API
TerraDev - Terraria OpenSource Hack
Форум игроделов » Программирование » Basic » Движение камеры в игре (blitz3d basic)
  • Страница 1 из 1
  • 1
Поиск:

Все права сохранены. GcUp.ru © 2008-2024 Рейтинг