Light Rotation bug

Blitz3D Forums/Blitz3D Bug Reports/Light Rotation bug

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.

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.:-)

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.

I repeat:
you have to do an UpdateWorld before asking for values back from EntityPitch() and other such commands.

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.

Answer is as per the other (Terrain) thread.
I'm just telling you what works for me.