Vector3Extensions
FivePD.API.Utils
#
Namespace: Source/Utils/Vector3Extensions.cs
#
File: #
Methods#
AroundReturns a random Vector3 (relative to the specified position), within a given radius.
Type:string#
ExampleVector3 position = Game.PlayerPed.Position.Around(175f);
#
RandomXyReturns a normalized Vector3 with random X and Y coordinates.
#
ExampleVector3 position = Vector3Extension.RandomXy();
#
DistanceToReturns the distance between 2 points.
Params:
- source
- Type: Vector3
- Original position
- target
- Type: Vector3
- Target position
#
ExamplePed targetPed;...float distanceTo = Game.PlayerPed.Position.DistanceTo(targetPed.positon);
#
ApplyOffsetReturns a Vector3 with the given offset applied on it.
Params:
- source
- Type: Vector3
- Source position
- offset
- Type: Vector3
- Offset value
#
ExampleVector3 offsetPos = Game.PlayerPed.Position.ApplyOffset(new Vector3(4.5f,3.0f,2.6f));
#
GroundHeightReturns the height of the given position.
Params:
- source
- Type: Vector3
- Source position
#
Examplefloat gHeight = Game.PlayerPed.Position.GroundHeight();
#
ClosestStreetNameReturns the closest street name.
Params:
- source
- Type: Vector3
- Source position
#
Examplestring street = Game.PlayerPed.Position.ClosestStreetName();
#
SetWaypointHereSets the player's waypoint to the given position.
Params:
- source
- Type: Vector3
- Source position
#
Examplenew Vector3(10f,10f,10f).SetWaypointHere(); // Will set a waypoint at that position
#
ClosestPedPlacementReturns the closest position (relative to the given position) where a ped can be placed on the sidewalk.
Params:
- source
- Type: Vector3
- Source position
#
ExampleVector3 position = new Vector3(10f,10f,10f).ClosestPedPlacement();
#
ClosestParkedCarPlacementReturns the closest position (relative to the given position) where a vehicle be placed on the side of the road.
Params:
- source
- Type: Vector3
- Source position
- unoccupied
- Type: bool (default:
true
) - If
true
, only unoccupied spots will be searched
- Type: bool (default:
#
ExampleVector3 position = new Vector3(10f,10f,10f).ClosestParkedCarPlacement(false);
#
GetClosestParkedCarReturns the closest parked vehicle (relative to the given position).
Params:
- source
- Type: Vector3
- Source position
#
ExamplesVehicle vehicle = new Vector3(10f,10f,10f).GetClosestParkedCar();