I'm trying to keep a 3d plane facing the camera at all angles but while i have some success with this:
Vector3 gunToCam = cam.cameraPosition - getWorld.Translation; Vector3 beamRight = Vector3.Cross(torpDirection, gunToCam); beamRight.Normalize(); Vector3 beamUp = Vector3.Cross(beamRight, torpDirection); shipeffect.beamWorld = Matrix.Identity; shipeffect.beamWorld.Forward = (torpDirection) * 1f; shipeffect.beamWorld.Right = beamRight; shipeffect.beamWorld.Up = beamUp; shipeffect.beamWorld.Translation = shipeffect.beamPosition;
*Note: Logic not wrote by me i just found this rather useful
It seems to only face the camera at certain angles. For example if i place the camera behind the plane you can see it that only Roll's around the axis like this:
http://i.imgur.com/FOKLx.png (imagine if you are looking from behind where you have fired from.
Any idea what to what the problem is (angles are not my specialty)
shipeffect is an object that holds this class variables: public Texture2D altBeam; public Model beam; public Matrix beamWorld; public Matrix gunTransforms; public Vector3 beamPosition;