Make Sprite always face the camera
Hi!
You solve one problem(now i have a plasmagun in my FPS that Fires from Gun Position into the middle of the screen) but at the same moment you always get a new one. this time it is the sprite that not is facing the cameraPosition at any given angle/rotation.
Is there any easy way of making the face/flat side of a sprite always face the camera position?
here is my view and WorldMatrix for my Sprite:
//the View
device.Transform.View = Matrix.LookAtLH(mPos, mView, mUp);
//the Sprite World Matrix
device.Transform.World = Matrix.Multiply(Matrix.Scaling(scale, scale, scale), Matrix.RotationYawPitchRoll(mPosX, pitch, roll) * Matrix.Translation(spritePos.X, spritePos.Y, spritePos.Z));
i have heard somethign about inverting the worldMatrix but i am not sure this is correct???
Billboard is the term used for the effect you are trying to achieve. Check out this page or search google for +directx +billboard.
If I am not mistaken point sprites are aligned with the view vector by default. So you can simply use them. Take a look at:
http://www.gamedev.net/reference/programming/features/pointspritevb/page2.asp
http://www.gamedev.net/reference/programming/features/pointspritevb/page2.asp
Quote:Original post by Matt Aufderheide
or use D3DXSprite, its has an easy option to draw view aligned sprites ..
Doh! I completely forgot about that.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement