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)); }
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(); } }
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); } }
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)); }
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; }
public static float Length(this GTANetworkShared.Vector3 left) { return((float)Math.Sqrt(left.LengthSquared())); }
public static float LengthSquared(this GTANetworkShared.Vector3 left) { return(left.X * left.X + left.Y * left.Y + left.Z + left.Z); }
private static bool IsInRangeSquared(GTANetworkShared.Vector3 center, GTANetworkShared.Vector3 dest, float range) { return(center.Subtract(dest).LengthSquared() <= range); }