示例#1
0
        /// <summary>
        /// Create a data instance from the raw ProcessLineOfSight output
        /// </summary>
        public SightLineData(Tuple <bool, float, float, float, MtaElement, float, float, Tuple <float, int, float, int, int?, float, float, Tuple <float, float, float, float, int> > > d)
        {
            DidHit = d.Item1;
            if (DidHit)
            {
                CollisionPosition = new Vector3(d.Item2, d.Item3, d.Item4);
                if (d.Item5 != null)
                {
                    HitElement = ElementManager.Instance.GetElement <PhysicalElement>(d.Item5);
                }
                Normal          = new Vector3(d.Item6, d.Item7, d.Rest.Item1);
                SurfaceMaterial = (SurfaceMaterialType)d.Rest.Item2;
                Lighting        = d.Rest.Item3;
                piece           = d.Rest.Item4;

                if (d.Rest.Item5 != null)
                {
                    WorldModelID     = d.Rest.Item5.Value;
                    WorldModelMatrix = Matrix4x4.CreateTranslation(d.Rest.Item6, d.Rest.Item7, d.Rest.Rest.Item1) + Matrix4x4.CreateFromQuaternion(NumericHelper.EulerToQuaternion(new Vector3(d.Rest.Rest.Item2, d.Rest.Rest.Item3, d.Rest.Rest.Item4)));
                    WorldLODModelID  = d.Rest.Rest.Item5;
                }
            }
        }
示例#2
0
 /// <summary>
 /// Attach this attachable to a toAttachable with 2 vectors describing a position offset and a rotation offset
 /// </summary>
 public void AttachTo(PhysicalElement toElement, Vector3 positionOffset, Vector3 rotationOffset)
 {
     AttachTo(toElement, positionOffset, NumericHelper.EulerToQuaternion(rotationOffset));
 }