Camera pivot of a pivot not moving?

Blitz3D Forums/Blitz3D Programming/Camera pivot of a pivot not moving?

Idiot(Posted 2004) [#1]
Ok, I've got a pivot on the ground. Above and back a bit is another pivot, whose parent is the pivot on the ground. There's a camera attached to it so you can see the problem. Move the ground pivot. The camera pivot moves. The camera moves. Except that it doesn't.

Am I missing something here?

[CODE]
;oh snap! there's trouble in graphics land!
Const SW=640,SH=480
Graphics3D SW,SH
SetBuffer BackBuffer()

;I'm camera pivot, sitting on the floor
Global cameraPivot=CreatePivot()
RotateEntity cameraPivot,0,45,0

;see? here I am!
s=CreateSphere(10,cameraPivot)
ScaleEntity s,.1,.1,.1

;here's my best friend in the world, other camera pivot
holyGeezOtherCameraPivot=CreatePivot(cameraPivot)
camera=CreateCamera(holyGeezOtherCameraPivot)

;he's way up in the sky! OMG!
PositionEntity holyGeezOtherCameraPivot,10,10,-10,True
RotateEntity holyGeezOtherCameraPivot,45,0,0

;We love to see with light, don't you?
light=CreateLight(1,camera)
MoveEntity light,20,0,0

;and we also love crap on the ground to see that we're moving
For i=0 To 500
r=Rand(1,4)
Select r
Case 1:
o=CreateCube()
Case 2:
o=CreateSphere()
Case 3:
o=CreateCylinder()
Case 4:
o=CreateCone()
End Select
PositionEntity o,Rnd#(-10,10),0,Rnd#(-10,10)
ScaleEntity o,.1,.1,.1
EntityColor o,125*(Rand(0,2)),125*(Rand(0,2)),125*(Rand(0,2))
Next ;i

;let's begin:
While Not KeyDown(1)

getInputs()

UpdateWorld
RenderWorld

Text 0,0,"The other pivot's x: "+EntityX#(holyGeezOtherCameraPivot)
Text 0,20,"The other pivot's z: "+EntityZ#(holyGeezOtherCameraPivot)

Text 0,400,"Use the mouse to move the camera pivot on the floor."
Text 0,420,"Use the left & right arrow keys to rotate the pivot on the floor."
Text 0,440,"Note how the pivot in the air (swinging around with the camera)"
Text 0,460,"DOESN'T MOVE!!!!!!"

Rect MouseX()-2,MouseY()-2,5,5

Flip

Cls


Wend

Function getInputs()

TurnEntity cameraPivot,0,(KeyDown(203)-KeyDown(205)),0

If MouseY()>SH-50 Then MoveEntity cameraPivot,0,0,-.1
If MouseY()<50 Then MoveEntity cameraPivot,0,0,.1

If MouseX()>SW-50 Then MoveEntity cameraPivot,.1,0,0
If MouseX()<50 Then MoveEntity cameraPivot,-.1,0,0

End Function
[/CODE]

Note the X & Y position of the other pivot. The same is the case for the camera. Move it all you like, it stays in one spot according to the entityX & entityz.


Shambler(Posted 2004) [#2]
Welcome to the world of Local coords and Global coords...

Text 0,0,"The other pivot's x: "+EntityX#(holyGeezOtherCameraPivot,True)
Text 0,20,"The other pivot's z: "+EntityZ#(holyGeezOtherCameraPivot,True)


What Blitz was telling you was that relative to camerapivot, holyGeezOtherCameraPivot was not moving.


Idiot(Posted 2004) [#3]
So... how do you get the Global coords?


Idiot(Posted 2004) [#4]
Wait, I bet it has something to do with EntityX#(entity[,global])... n/m