public void DrawHud(IMyCameraController camera, long playerId) { MyGunStatusEnum status; CanShoot(MyShootActionEnum.PrimaryAction, playerId, out status); if (status == MyGunStatusEnum.OK || status == MyGunStatusEnum.Cooldown) { var matrix = m_gunBase.GetMuzzleWorldMatrix(); var from = matrix.Translation; var to = from + 50 * matrix.Forward; Vector3D target = Vector3D.Zero; if (MyHudCrosshair.GetTarget(from, to, ref target)) { float distance = (float)Vector3D.Distance(MySector.MainCamera.Position, target); MyTransparentGeometry.AddBillboardOriented( "RedDot", Vector4.One, target, MySector.MainCamera.LeftVector, MySector.MainCamera.UpVector, distance / 300.0f); } } }
public void DrawHud(IMyCameraController camera, long playerId) { ProfilerShort.Begin("Can shoot"); MyGunStatusEnum status; CanShoot(MyShootActionEnum.PrimaryAction, playerId, out status); ProfilerShort.End(); if (status == MyGunStatusEnum.OK || status == MyGunStatusEnum.Cooldown) { var from = PositionComp.GetPosition() + PositionComp.WorldMatrix.Forward; var to = PositionComp.GetPosition() + 50 * PositionComp.WorldMatrix.Forward; Vector3D target = Vector3D.Zero; if (MyHudCrosshair.GetTarget(from, to, ref target)) { float distance = (float)Vector3D.Distance(MySector.MainCamera.Position, target); MyTransparentGeometry.AddBillboardOriented( "RedDot", Vector4.One, target, MySector.MainCamera.LeftVector, MySector.MainCamera.UpVector, distance / 300.0f); } } }