Light Rotation bug

Archives Forums/Blitz3D Bug Reports/Light Rotation bug

xmlspy(Posted 2007) [#1]
I have noticed that when you use the command RotateEntity with a light it works only with Pitch.

Given values:
Pitch: 90
Yaw: 20
Roll: 25

Returned values with EntityPitch, EntityYaw, and EntityRoll commands:
Pitch: 90
Yaw: -180
Rol: 180



Some code:
Graphics3D 640, 480, 0, 2
cam =CreateCamera()
h = CreateLight()

RotateEntity h, 90, 20, 25

DebugLog "CHECK: Pitch: " + EntityPitch(h) + " | Yaw: " + EntityYaw(h) + " | Roll: " + EntityRoll(h)

WaitKey()
End


Computer Info:
DX9 C
ATI Radeon X1950 512 MB - Latest drivers
B3D Version: 1.98, Userlibs: none
AMD Athlon 64 X2
WinXP Pro


[update]
Actually the rotation bug applies to any entity, not just lights.


John Blackledge(Posted 2007) [#2]
I came across this a while ago - you have to do an UpdateWorld before asking for values back from EntityPitch() and other such commands. (Mmmm... yes it is, isn't it.:-)


Floyd(Posted 2007) [#3]
This is really about gimbal lock. A rotation like this

RotateEntity ent, 90, anything, anything

leaves the z-axis pointing directly down, where the negative y-axis used to be. Thus yaw and roll both turn around the same (vertical) axis.


John Blackledge(Posted 2007) [#4]
I repeat:
you have to do an UpdateWorld before asking for values back from EntityPitch() and other such commands.


big10p(Posted 2007) [#5]
John: you don't even need to call UpdateWorld unless you're using animation and/or collisions. You can grab the pitch (etc.) of an entity directly after rotating it just fine. The problem here is surely as Floyd describes.


John Blackledge(Posted 2007) [#6]
Answer is as per the other (Terrain) thread.
I'm just telling you what works for me.