public void ApplyTo(Vehicle vehicle, SpawnFlags spawnFlags = SpawnFlags.Default) { ApplyTo2(vehicle, spawnFlags.HasFlag(SpawnFlags.NoOccupants)); if (!spawnFlags.HasFlag(SpawnFlags.NoPosition)) { vehicle.PositionNoOffset = Position; vehicle.Heading = Heading; vehicle.Rotation = Rotation; } if (spawnFlags.HasFlag(SpawnFlags.SetRotation)) { vehicle.Rotation = Rotation; } if (!spawnFlags.HasFlag(SpawnFlags.NoVelocity)) { vehicle.Velocity = Velocity; vehicle.Speed = Speed; } if (spawnFlags.HasFlag(SpawnFlags.NoWheels)) { return; } for (int i = 0; i < WheelsRotations.Length; i++) { VehicleControl.SetWheelRotation(vehicle, i, FusionUtils.Wrap(WheelsRotations[i], -(float)Math.PI, (float)Math.PI)); VehicleControl.SetWheelCompression(vehicle, i, WheelsCompressions[i]); } }
/// <summary> /// Sets end movement properties. /// </summary> /// <param name="positionOffset"></param> /// <param name="pointAtOffset"></param> /// <param name="fieldOfView"></param> /// <param name="wait"></param> /// <param name="switchDuration"></param> public void SetEnd(Vector3 positionOffset, Vector3 pointAtOffset, float fieldOfView, int wait, int switchDuration) { PositionEndOffset = positionOffset; if (isVehicle) { PointAtEndOffset = FusionUtils.DirectionToRotation(positionOffset, pointAtOffset, 0); } else { PointAtEndOffset = pointAtOffset; } FieldOfViewEnd = fieldOfView; Wait = wait; SwitchDuration = switchDuration; Moving = true; }
public void ApplyTo(Vehicle vehicle, SpawnFlags spawnFlags = SpawnFlags.Default, VehicleReplica nextReplica = default, float adjustedRatio = 0) { ApplyTo2(vehicle, spawnFlags.HasFlag(SpawnFlags.NoOccupants)); if (nextReplica == default || nextReplica == null) { nextReplica = this; } if (!spawnFlags.HasFlag(SpawnFlags.NoPosition)) { vehicle.PositionNoOffset = FusionUtils.Lerp(Position, nextReplica.Position, adjustedRatio); vehicle.Heading = FusionUtils.Lerp(Heading, nextReplica.Heading, adjustedRatio); vehicle.Rotation = FusionUtils.Lerp(Rotation, nextReplica.Rotation, adjustedRatio, -180, 180); } if (spawnFlags.HasFlag(SpawnFlags.SetRotation)) { vehicle.Rotation = FusionUtils.Lerp(Rotation, nextReplica.Rotation, adjustedRatio, -180, 180); } if (!spawnFlags.HasFlag(SpawnFlags.NoVelocity)) { vehicle.Velocity = FusionUtils.Lerp(Velocity, nextReplica.Velocity, adjustedRatio); vehicle.Speed = FusionUtils.Lerp(Speed, nextReplica.Speed, adjustedRatio); } if (spawnFlags.HasFlag(SpawnFlags.NoWheels)) { return; } for (int i = 0; i < WheelsRotations.Length; i++) { VehicleControl.SetWheelRotation(vehicle, i, FusionUtils.Lerp(WheelsRotations[i], nextReplica.WheelsRotations[i], adjustedRatio)); VehicleControl.SetWheelCompression(vehicle, i, FusionUtils.Lerp(WheelsCompressions[i], nextReplica.WheelsCompressions[i], adjustedRatio)); } }
public Model Request() { return(FusionUtils.LoadAndRequestModel(Model, Name)); }
internal CustomCamera(Vehicle vehicle, Vector3 positionOffset, Vector3 pointAtOffset, float fieldOfView, int duration = -1) : this((Entity)vehicle, positionOffset, pointAtOffset, fieldOfView, duration) { isVehicle = true; PointAtOffset = FusionUtils.DirectionToRotation(PositionOffset, PointAtOffset, 0); }