- fixed: camera facing sprites need to orient themselves toward the actual camera position, not the view actor (which may be invalid or in a completely different part of the map if a portal is being rendered.)

This commit is contained in:
Christoph Oelckers 2016-05-03 19:24:28 +02:00
parent b6af4677f3
commit 0f8f08edfd
1 changed files with 2 additions and 2 deletions

View File

@ -287,8 +287,8 @@ void GLSprite::Draw(int pass)
if (drawBillboardFacingCamera) {
// [CMB] Rotate relative to camera XY position, not just camera direction,
// which is nicer in VR
float xrel = xcenter - GLRenderer->mViewActor->X();
float yrel = ycenter - GLRenderer->mViewActor->Y();
float xrel = xcenter - ViewPos.X;
float yrel = ycenter - ViewPos.Y;
float absAngleDeg = RAD2DEG(atan2(-yrel, xrel));
float counterRotationDeg = 270. - GLRenderer->mAngles.Yaw.Degrees; // counteracts existing sprite rotation
float relAngleDeg = counterRotationDeg + absAngleDeg;