Ответ: Вопрос-Ответ (для новичков)
Вот такая непонятка: допустим, я хочу что бы пуля летела не из центра камеры, а чуть левее. Применяю определённые параметры (смещаю на три левее). Но почему-то пуля не та как мне надо летит. При повороте камеры, её позиция (пули) меняется. Пример, чтобы знали о чём я:
Graphics3D 800,600,32,2
SetBuffer BackBuffer ()
light=CreateLight ()
cam=CreateCamera ()
PositionEntity cam,0,3,0
plane=CreatePlane ()
EntityColor plane,100,200,100
wall=CreateCube ()
PositionEntity wall,0,3,3
;ScaleEntity wall,5,3,0
EntityColor wall,200,100,100
Type Bullet
Field model
End Type
Function CreateBullet(parent%)
a.Bullet=New Bullet
a\model=CreateSphere (16)
PositionEntity a\model,EntityX(parent%)+3, EntityY(parent%), EntityZ(parent%)
RotateEntity a\model, EntityPitch(parent%), EntityYaw(parent%), EntityRoll(parent%)
;EntityParent a\model,parent%
End Function
Function UpdateBullet ()
For b.Bullet= Each Bullet
MoveEntity b\model,0,0,0.1
Next
End Function
Repeat
If MouseHit (1) Then CreateBullet(cam)
mxspd#=MouseXSpeed()*0.5
myspd#=MouseYSpeed()*0.5
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
campitch#=EntityPitch(cam)+myspd#
If campitch#<-89 Then campitch#=-89
If campitch#>89 Then campitch#=89
RotateEntity cam,campitch#,EntityYaw(cam)-mxspd#,EntityRoll(cam)
UpdateBullet ()
RenderWorld ()
Flip
Until KeyHit (1)
End
__________________
Самый первый и самый великий программист - это Бог.
|