public static bool WorldToScreen(Vector3D worldLocation, ref float screenX, ref float screenY) { ViewAngles View = Memory.Read <ViewAngles>(SignatureManager.GetViewAngle()); RefDef Refdef = Memory.Read <RefDef>(SignatureManager.GetWorldToViewMatrix()); Vector3D vTransform; Vector3D vLocal = worldLocation - View.Origin; vTransform.X = vLocal.Dot(Refdef.ViewAxis2); vTransform.Y = vLocal.Dot(Refdef.ViewAxis3); vTransform.Z = vLocal.Dot(Refdef.ViewAxis1); // Make sure the player is in front of us. if (vTransform.Z < 0.1) { return(false); } screenX = (Overlay.Width / 2) * (1 - (vTransform.X / Refdef.FovX / vTransform.Z)); screenY = (Overlay.Height / 2) * (1 - (vTransform.Y / Refdef.FovY / vTransform.Z)); return(true); }
public void CreateInstanceProperties() { _instanceProperties = RefDef != null && RefClassId >= 0 && RefClassId < RefDef.Classes.Count ? RefDef.GetClassInstanceProperties(RefClassId) : new NameList(); }