I'm trying to get a sprite to tilt to face the camera in 3D space, at the moment I can get it to spin to face the camera (Rotate on the XZ) but I need it to tilt backwards to face the camera.
I have the:
X, Y, Z position of the sprite I want to face the camera.
X, Y, Z position of the camera.
Forward vector of the camera.
Rotation of the camera.
Where do I start? I can get it to spin to face the camera and that's about it so far.
EDIT: I can get it to lean back now, so all that's left is getting it to rotate so when the camera's facing downwards it doesn't look like all the sprites are leaning over (They're aligned to the screen still, need Z rotation).
The code is literally rotating the 4 vertices to match the camera's rotation.
I have the:
X, Y, Z position of the sprite I want to face the camera.
X, Y, Z position of the camera.
Forward vector of the camera.
Rotation of the camera.
Where do I start? I can get it to spin to face the camera and that's about it so far.
EDIT: I can get it to lean back now, so all that's left is getting it to rotate so when the camera's facing downwards it doesn't look like all the sprites are leaning over (They're aligned to the screen still, need Z rotation).
The code is literally rotating the 4 vertices to match the camera's rotation.