Question by
Rolandochanlaw · Sep 30, 2015 at 05:58 PM ·
rotationeuleranglesperspective
Flipping cards to face camera at weird angles
My 3D math is not so fresh these days (too much work in 2D games.)
I have a memory matching game in which the player flips cards to find matches. I recently reverted the camera from Orthographic to Perspective. I rotate the card with this function
float rotateRate = 180; transform.localEulerAngles = new Vector3 (0, rot, (-defaultZRotation * time) / animationTime);
The card will flip to face 180, but depending on it's position on the screen from the camera, that angle sets the cards to face a little off from directly looking at the camera.
What do I need to add to get this to face the camera and look like it is lying flat on the game board?
Comment