示例#1
0
 public static GTA.Math.Vector3 ToVector(this GTANetworkShared.Vector3 v)
 {
     if ((object)v == null)
     {
         return(new Vector3());
     }
     return(new GTA.Math.Vector3(v.X, v.Y, v.Z));
 }
示例#2
0
        public void DeleteObject(GTANetworkShared.Vector3 pos, float radius, int modelHash)
        {
            Prop returnedProp = Function.Call <Prop>(Hash.GET_CLOSEST_OBJECT_OF_TYPE, pos.X, pos.Y, pos.Z, radius, modelHash, 0);

            if (returnedProp != null && returnedProp.Handle != 0)
            {
                returnedProp.Delete();
            }
        }
示例#3
0
        internal void Interpolate(int netHandle, int gameHandle, Vector3 newPos, GTANetworkShared.Vector3 newVelocity, Vector3 newRotation)
        {
            if (!Interpolations.ContainsKey(netHandle))
            {
                var interp = new UnoccupiedVehicleInterpolator(gameHandle, netHandle);
                interp.SetTargetPosition(newPos, newVelocity, newRotation);

                Interpolations.Set(netHandle, interp);
            }
            else
            {
                Interpolations[netHandle].SetTargetPosition(newPos, newVelocity, newRotation);
            }
        }
示例#4
0
 public static GTANetworkShared.Vector3 Add(this GTANetworkShared.Vector3 left, GTANetworkShared.Vector3 right)
 {
     if ((object)left == null && (object)right == null)
     {
         return(new GTANetworkShared.Vector3());
     }
     if ((object)left == null)
     {
         return(right);
     }
     if ((object)right == null)
     {
         return(left);
     }
     return(new GTANetworkShared.Vector3(left.X + right.X, left.Y + right.Y, left.Z + right.Z));
 }
示例#5
0
        internal void SetTargetPosition(Vector3 targetPos, GTANetworkShared.Vector3 velocity, Vector3 rotation)
        {
            var dir = targetPos - _prop.Position.ToVector();

            NetInterpolation.vecTarget = targetPos;
            NetInterpolation.vecError  = dir;

            NetInterpolation.StartTime  = Util.Util.TickCount;
            NetInterpolation.FinishTime = NetInterpolation.StartTime + 400;
            NetInterpolation.LastAlpha  = 0f;

            _velocity = velocity;
            _rotation = rotation;

            _startPos = _prop.Position.ToVector();
            _startRot = _prop.Rotation.ToVector();

            _prop.Rotation = rotation.ToLVector();
            _prop.Position = targetPos.ToLVector();

            HasFinished = false;
        }
示例#6
0
 public static float Length(this GTANetworkShared.Vector3 left)
 {
     return((float)Math.Sqrt(left.LengthSquared()));
 }
示例#7
0
 public static float LengthSquared(this GTANetworkShared.Vector3 left)
 {
     return(left.X * left.X + left.Y * left.Y + left.Z + left.Z);
 }
示例#8
0
 private static bool IsInRangeSquared(GTANetworkShared.Vector3 center, GTANetworkShared.Vector3 dest, float range)
 {
     return(center.Subtract(dest).LengthSquared() <= range);
 }