Full code documentation - Team-Swamp/CaptureGraafsmeer GitHub Wiki

This is a wiki page with the full documentation of every piece of code. Any class can be found here.

Some feature were made during our practice exam IceBites.

Animated buttons

Written by Bas

To navigate to the different user interface panels, there are some animated buttons inspired by the buttons of Pokémon Go. First, click on the Amsterdam logo to see some buttons fly out. Then, press one to display a panel, such as the introduction panel.

drawing

Usage

Methods Return Description
+ ForceReset() void Resets the button the to beginning state, without questions
+ TogglePlacement() void If the button is at the begin position it will move to the target position, otherwise in reverse.
- AnimateScale(Vector3) IEnumerator Move the buttons to it's given target location

Source

The script for animated buttons.

Animation Controller

The animation controller is a simple script that controls the animations of either the player or the NPC. This works by creating triggers that will decide whether an animation gets played.

Written by William

Usage

Flowchart

---
title: Animation Controller
---
graph TD;
    A[Start] --> B{Animator Assigned?};
    B -->|Yes| C[Play Animation];
    B -->|No| D(Error: No Animator Assigned);
    C --> E{Valid Animation?};
    E -->|Yes| F(Set Trigger);
    E -->|No| G(Error: Invalid Animation);
Loading

The class

The script requires a component of the type Animator. Otherwise it will not function.

Methods Return Description
+ PlayAnimation(string) void Play's an animation by activating the trigger given as a string
- IsValidAnimation(string) bool Checks if the animation trigger exists.

Source

If u wish to take a closer look at the script Animation Controller.

Camera Panel

Written by Martijn

The camera panel is a screen put in between the interaction of a point of interest and taking the photo.

camerapanel

Usage

Methods Return Description
+ SetPanelData(PhotoData) void Sets the information in the Camera Panel according to the values from the PhotoData Scriptable Object

Source

Camera Panel

Culling

Written by Bas & William

To make the performance better we have of the game we will enable & disable objects if there in the camera view or not. We do this with 2 kinds of culling: Frustum Culling & Occlusion culling

Frustum culling

Frustum culling is a technique used in computer graphics to increase rendering performance by eliminating objects that fall outside of the camera's view frustum, which is essentially the pyramid-shaped region in front of the camera. This process ensures that only objects within the camera's field of view are considered for rendering, reducing unnecessary calculations for objects that are not visible to the player.

Occlusion culling

Occlusion culling in Unity prevents rendering calculations for GameObjects hidden from view, utilizing data generated during baking to determine visibility at runtime, enhancing performance by excluding unnecessary rendering operations.

Usage

Every method is private.

Methods Return Description
InitCullingObjects() void This function initializes the culling objects by finding all GameObjects with the "Cullable" tag and caching their Renderer components
UpdateCullAbles() void This function updates the visibility of culling objects by testing if they are within the camera's frustum and not occluded by other objects.
OcclusionCulling(ref bool, int) void This function checks if the culling object is occluded by other objects by casting a ray from the camera to the object and checking if it hits any other objects. If it does, the object is set to be invisible.

Source

The class of Culling.

Enum extensions

This is a static class that improve the usage of enum with custom attributes.

Written by Bas

Usage

Every method is public.

Methods Return Description
GetString(Enum) string Get the string of an enum type. If not existing returns empty string
GetChar(Enum) char Get the char of an enum type. If not existing returns empty char ('\0')
GetVector2(Enum) Vector2 Get the Vector2 of an enum type. If not existing returns vector2.zero
GetVector3(Enum) Vector3 Get the Vector3 of an enum type. If not existing returns vector3.zero
GetRandomEnumValue T Retrieves a random enum value of the specified type. Returns a random enum value of type T
Vector3 use case

Vector 3 attributes

image

Enum with Vector3

image

Using the enums Vector3

image

GetRandomEnumValue use case

image

Source

Static class

EnumExtensions.cs

Attributes

  1. CharValue
  2. StringValue
  3. Vector2Value
  4. Vector3Value

Flashing buttons

Written by Bas

After taking a photo, the main button and photobook button will start flashing to draw attention and guide users to view the photo. This ensures users easily locate the photo for viewing.

drawing

Usage

Methods Return Description
+ ActivateFlashing() void Activate the flashing of the button
+ DeactivateFlashing() void Deactivate the flashing of the button
- Flashing() IEnumerator Coroutine that continuously flashes the button by interpolating its color between the startColor and flashedColor at a specified speed.

Source

The script that flashes the buttons.

Route Highlighter

The Route Highlighter is a simple system that draws a line between all the points in a list. The lines will indicate the route that you need to walk, and will update accordingly. Route Highlighter

Usage

Flowchart

graph TD;
    Start --> DrawLines;
    DrawLines --> WalkToWaypoint;
    WalkToWaypoint --> RemovePreviousLine;
    RemovePreviousLine --> |if LastWaypoint | Done
    RemovePreviousLine --> |if not LastWaypoint | RedrawLines 
Loading

Settings

Methods Return Description
- UpdateLine() void This function will create the line between all of the designated points in the list
- RemoveLine() void This function will remove the previous line and reupdate all the current lines. This also takes care of disabling the lines when you've finished the route

Source

Route Highlighter

Route Line settings

The settings added by this feature were implemented to help the more visually impaired users. They can also be used to add a bit of personal flair while walking the route. When opening the menu, the user is presented by a choice of nine colors and a choice of line width. The choice of color is especially important for colorblind people, who may have trouble differentiating the line itself from its surroundings.

The color is changed by clicking on the colored button and applied to the Line Renderer's color value automatically. It sets both the starting and end color value to make sure the line is one color.

The line width is changed by dragging the slider to the left or right. The minimal width is 0.5 so the user can't make the line invisible, as the line is an integral part of the app. When the value of the slider changes, the user can immediately see the current value of the line width. The line width is immediately changed when the slider moves.

RouteLineSettings

Usage

ColorPicker Return Description
+ ChangeColor(ColorChange) void Changes the LineRenderer's line color to the selected color from the ColorChange script
- ChangeColor(int) void Changes the LineRenderer's line color to the given color by index
- SetRouteColor(Color) void Sets the linderrender's color that has been given
- GetColor(RouteColors) Color Gets a color depending on the RouteColors' Enum Index value from the colors List
RouteLineWidth Return Description
+ ChangeWidth void Divides the widthSlider's value by 2 and calls SetWidth() to change the Line Renderer's line width
- SetWidth(float) void Changes the numerical value beneath the slider and sets the Line Renderer's line width

Source

Geo location

We aim to provide precise real-time user location within the game. This is achieved by retrieving latitude and longitude coordinates from Google Maps and converting them into meters. We utilize the formula: $\left(\text{latitude and longitude} \times \frac{\pi}{180}\right) \times \text{Earth's radius} \ (6378137 \ \text{meters})$, the 180 is the amount of degrees of a half circle. We convert the coordinates to meters because the scale of the area would be incorrect when using the raw coordinates due to the curvature of the Earth.

This methodology ensures an accurate navigation experience for users exploring Amsterdam-Oost within the game world.

It will also behave diffrently depending on wich type it has. STATIC will update at the start of the game and never again. PLAYER will update over and over again with the players location. STATIC_DEBUG & PLAYER_DEBUG will update after some time with the given coordinates form the varible.

Written by Bas

drawing

Usage

CoordinatesTransform Return Description
+ SetCords(Vector2) void Set the coordinates to a new value.
- UpdateLocation(Vector2 ?) void Updates the location of the gameobject via the coordinates
- ConvertToMeters(double, double) (double, double) Converts latitude & longitude to meters
- LerpPosition(Vector3) IEnumerator Lerps the position from point A to point B over time
- ShouldUpdateLocation() void Allows the position to be updated again after a delay
GeoPositionText Return Description
- SetText(float, float) void Set the current position of the player in text

Source

See here all the used classes fully:

Introduction

Writen by Bas

Art by Taquila

The client asked if we could add an introdution to the game, so we made a simple introduction. It's a panel with mulitple pages there you can go through, there is a photo and some text in each. It will also show when playing for the first time. It can be closed, only when having seen the last page.

drawing drawing

Usage

IntroductionPopup Return Description
- AnimateScale(Vector3) IEnumerator Scales the pop-up form nothing to almost full display, or otherwise
+ Open() void Opens the information panel with a small growing animation
+ Close() void Closes the information panel with a small shrinking animation
+ GetNextInfo() void Get the next info for displacement.
+ GetBackInfo() void Get the previous info for displacement.
# SetCurrentItem(bool) void Set the current item to display. Plus changes pagination dots colors.
- InitPaginationDots() void Initialize the pagination dots of the introduction pop-up
- Activate() void Activete the pop-up with a delay

Source

Menu's

The UI scripts I made serve 2 purposes. The settings script's purpose is loading, saving and creating the settings. The MenuSwitcher's purpose is switching from one menu to another without too much hassle.

Usage

Settings

Methods Return Description
+ LoadSettings() void LoadSettings is a function that will check if there are any settings that have been changed from it's default value. If there weren't any changes it will load the default values. If there have been changes it will load those settings.
+ ApplySettings() void Apply settings is linked to the apply button. It saves a boolean into a playerpref which says that settings have been changed from it's default value
+ SetVolume(float) void This changes the volume and saves the value of the float into a playerpref. This is hooked up to a slider.
+ SetQuality(int) void This changes the quality of the game to the int that is selected. This is hooked up to a dropdown. The int being the value of the dropdown.
+ SetFullscreen(bool) void This sets the game to either fullscreen, or windowed. This is hooked up to a button
+ SetResolution(int) void This changes the Resolution of the game to the int that is selected. The int is the index of the resolution dropdown
- SetHighestQuality() void This sets the game to the highest quality
- GetDefaultResolution() void This gets the highest possible resolution it can get and then sets that as its default
- PopulateResolutions() void This will fill the Resolution Dropdown with all the possible Resolutions it can find that are on the device.

Menu Switcher

Method Return Description
+ HideMenu(Gameobject) void This will hide a specific Gameobject that is given through a unity event
+ ActivateMenu(Gameobject) void This will reveal/activate a specific Gameobject that is given through a unity event.
+ TogglePauseGame() void This will check if the game is paused, if it is not it will stop the timescale
+ PausingEvent() void This will invoke the PausingGame event which allows us to easily add what should happen once the game is paused.

Source

If u wish to take a closer look at the scripts:

Photo taking

A seamless photo taking system, with a simple to understand zoom functionality. This will be used for the interactable points of intress. These photo's will be used for the photo book.

Full: Short: Zoom:
Full GIF Short GIF Zoom GIF

Written by Bas

Usage

PhotoData methods Return Description
+ SaveTexture(Texture2D) void Save the texture to a byte array
+ LoadTexture() Texture2D Load the texture from the saved byte array
PhotoTaker methods Return Description
+ StartCamera() void Will start the assign camera to play and will apply it to the live camera image
+ TakePhoto() void Captures the current frame and applies it to the photo image
+ Zoom(float) void Set the zoom amount of the camera
- FindCamera() void Finds a available camera to make photos with, if there aren't any it will give an error
- CaptureFrame(WebCamTexture) Texture2D Returns a texture with this frame's camera texture

Source

Object Interaction Ray

The Object Interaction Ray is a versatile tool designed to enhance gameplay across various platforms, including PC, mobile, and tablet devices. With its universal functionality, players can seamlessly click and interact with in-game elements, ensuring a smooth and immersive gaming experience regardless of the device they're using. This intuitive feature adds depth and engagement to gameplay, allowing users to effortlessly navigate and engage with the virtual world at their fingertips.

Written by Martijn

Usage

Methods Return Description
- GetMousePosition Vector3 Gets the position of the mouse / finger on the touchscreen
- Interact void Shoots out a raycast in the direction of GetMousePosition, that when it hits an object with the INTERACTABLE_TAG invokes an event
Events Description
onInteract The event that triggers when the ray from Interact collides with this object.

InteractRaygif

Source

Photobook

To learn about Amsterdam-Oost you have a photobook. In here there are missing photo's. When you have taken a photo you will see it in the book with information about so you can learn form it. You can flip through the pages and see you collection. This will be saved between play session, even if you accidentally close the game.

Written by Bas

Art by Taquila

drawing drawing

Usage

PhotoBook Return Description
+ OpenNextPage() void Opens the next page with animation
+ CloseCurrentPage() void Close the current page with animation
+ SetCurrentPageProperties() void Finds the correct page and set its properties
- SetupPhotoBook() void On enable it will setup the book correctly
- CheckButtonsUsability() void Will show or not the next and back button when applicable
- ViewPages() void Will show the current page, the others will not
Page Return Description
+ SetProperties() void Set the title, photo and info text of this page
+ ForceClose() void Closes this page, without questions
+ ForceOpen() void Opens this page, without questions
+ AnimatePage(bool) void Calls the animation for the page, if it's open it will close, otherwise it will go form close to open
- AnimateScale(Vector3) IEnumerator Will over time transform to the target Vector3 with the animation curve
PhotoInteractable Return Description
+ SetPhotoData() void Set this PhotoInteractable as the current in the PhotoTaker
+ GetInfo() string Get the text to show in the page, if visited will show the text for it, otherwise the default text
+ SaveTexture(Texture2D) void Save the texture to a byte array
+ GetTexture() Texture2D Get the texture to show, if this is visited it will show the made photo, otherwise the default texture
- LoadTexture() Texture2D Load the texture from the saved byte array

UML

---
title: Photobook system
---
classDiagram
    class PhotoInteractable{
        - const string NO_TEXTURE_TO_SAVE
        - const string NO_TEXTURE_TO_LOAD
        - const string SAVED_TEXTURE
        - PhotoTaker parent
        - PhotoData data
        - byte[] _textureBytes
        + bool IsVisited() get/set
        + Page ParentPage() get/set
        + SetPhotoData()
        + GetInfo() string
        + SaveTexture(Texture2D) bool
        + GetTexture() Texture2D
        - LoadTexture() Texture2D
    }
    class PhotoTaker{
        - const string NO_CAMERA_ERROR
        - const string NO_PHOTO_INTERACTABLE_ERROR
        - const string CAMERA_NOT_ACTIVE_ERROR
        - const string UNABLE_TO_SAVE_PHOTO_ERROR
        - RawImage liveCamera
        - RawImage lastPhoto
        - Texture2D defaultTex
        - WebCamTexture _webcamTexture
        - Texture2D _currentPhoto
        - PhotoInteractable _currentInteractable
        + PhotoData Data() get/set
        + Texture2D DefaultTex() get
        + PhotoInteractable CurrentPhotoInteractable() get
        - UnityEvent onOpenCamera
        - UnityEvent onPhotoTaken
        - Awake()
        - OnDisable()
        + StartCamera()
        + TakePhoto()
        + SetCurrentPhotoInteractable(PhotoInteractable)
        + FindCamera()
        - CaptureFrame(WebCamTexture) Texture2D
    }
    class CameraPermission{
        - const string CAMERA_PERMISSION
        # OnEnable()
    }
    class PhotoBook{
        - Page[] pages
        - GameObject nextButton
        - GameObject previousButton
        - PhotoTaker photoTaker
        - int _currentPage
        - Awake()
        - OnEnable()
        + OpenNextPage()
        + CloseCurrentPage()
        + SetCurrentPageProperties()
        - SetupPhotoBook()
        - CheckButtonsUsability()
        - ViewPages()
    }
    class Page{
        - readonly Vector3 _closed
        - RawImage photo
        - TMP_Text title
        - TMP_Text info
        - PhotoInteractable interactable
        - PhotoData data
        - float animationDuration
        - AnimationCurve animationCurve
        - RectTransform _rect
        + PhotoInteractable GetPhotoInteractable() get
        - Awake()
        + SetProperties()
        + ForceClose()
        + ForceOpen()
        + AnimatePage(bool)
        - AnimateScale(Vector3) IEnumerator
    }

    CameraPermission <|-- PhotoTaker : inheritance
    PhotoBook --> Page : 1, *
    PhotoInteractable --> Page : 1, 1
    PhotoTaker --> PhotoInteractable : 1, *
Loading

Source

Also take a look at photo taking, here you can see how photos are made.

Save system

This is a simple save system to track your progress along the route. It allows you to close the game and resume later, even if you need to use your phone for something else.

It also saves the setting from the route line.

Source

The Saver script.

Scene switcher

This is a simple class to make the switch and loading of scene simple.

Written by Bas

Usage

Method Return Description
+ LoadScene() void Load the scene that is set (sceneToLoad property)
+ LoadSceneAsync() Ienumerator This is a coroutine to load a new scene asynchronously. This allows for the progress of scene loading to be logged and displayed.
+ SetAndLoadScene() void Set the sceneToLoad property to a new scene, if this succeeds it will load it, otherwise it will give an error
+SetAndLoadSceneAsync() void Set the sceneToLoad property to a new scene, if the scene exists it will load it asynchronously. Otherwise it will give an error
+ SetSceneToLoad() bool Set the sceneToLoad property to a new scene, if it's not in the build settings you will get an error
- SceneExists(string) bool Looks at the build settings if the given scene is in it.

Source

You want to see how it works SceneSwitcher.cs.

Timer

A easy to use timer class. With multiple events that can be used. There is an editor script that enhances the usage of the timer class.

Written by Bas

Usage

Methods Return Description
+ ResetTimer void Reset the timer to startingTime and calls the onReset event
+ SetCanCount(bool) void Set the canCount property, when setting it to true it will start counting, otherwise is stops
+ SetTimerLenght(float) void Set the timer length, when resetting it will use this number
+ GetCurrentTimerLenght float Get the timer it's current length
+ GetCurrentTimerPercentage float Calculates the percentage of the current timer relative to the progress. Return a number between 0-1
- Counting void The function that counts the timer. Calls events when it's needs to
Events Description
onTimerDone An event for when the timer is done with counting
onTimerPassedThreshold An event for when the timer is has passed the threshold when counting up
onStart An event for when starting counting
onReset An event for when resetting the timer
Timer class Unity inspector

image image

Source

You want to see how it works Timer.cs, there is also a custom editor script for it.

UI Statemachine

This is a statemachine created for the User Interface which allows for easy and efficient switching between the UI elements without causing errors.

Written by William

Usage

UIStateCaller

Methods Return Description
+ StateChange() Void This changes the state through a unity event to a specific state given by an object

UIStateManager

Methods Return Description
+ SwitchState() Void This is a function with a switchcase which allows the script to prevent switching from certain states, and controls what happens during the states.
drawing

Source

If you want to see how it works

Vector extensions

Provides versatile extensions for Vector2 and Vector3, enhancing functionality for various operations.

A important note, the following examples and explanations are for both Vector2 and Vector3 except the Z axis.

Written by Bas

Usage

Every method is public.

When a '*' is added, it means it's only for Vector3.

When a '?' is added, it means that it's optional.

Set

Set method Return Description
SetX(float) This Vector3 / Vector2 Change the X vector of this Vector3 / Vector2
SetY(float) This Vector3 / Vector2 Change the Y vector of this Vector3 / Vector2
SetZ(float) This Vector3 Change the Z vector of this Vector3

Add

Add method Return Description
Add(Vector3 / Vector2) This Vector3 / Vector2 Add the Axis of two Vector3 / Vector2 into one.
AddX(Vector3 / Vector2) This Vector3 / Vector2 Add the X Axis of two Vector3 / Vector2 into one
AddY(Vector3 / Vector2) This Vector3 / Vector2 Add the Y Axis of two Vector3 / Vector2 into one
AddZ(Vector3) This Vector3 Add the Z Axis of two Vector3 into one
Add(float, float, *float) This Vector3 / Vector2 Add the specified values to the Axis of this Vector3 / Vector2
AddX(float) This Vector3 / Vector2 Add the specified value to the X Axis of this Vector3 / Vector2
AddY(float) This Vector3 / Vector2 Add the specified value to the Y Axis of this Vector3 / Vector2
AddZ(float) This Vector3 Add the specified value to the Z Axis of this Vector3

Subtract

Subtract method Return Description
Subtract(Vector3 / Vector2) This Vector3 / Vector2 Subtract the Axis of the second Vector3 / Vector2 from the first Vector3 / Vector2and return the result
SubtractX(Vector3 / Vector2) This Vector3 / Vector2 Subtract the X Axis of the second Vector3 / Vector2 from the first Vector3 and return the result
SubtractY(Vector3 / Vector2) This Vector3 / Vector2 Subtract the Y Axis of the second Vector3 / Vector2 from the first Vector3 and return the result
SubtractZ(Vector3) This Vector3 Subtract the Z Axis of the second Vector3 from the first Vector3 and return the result
Subtract(float, float, *float) This Vector3 / Vector2 Subtract the specified values from the Axis of this Vector3 / Vector2
SubtractX(float) This Vector3 / Vector2 Subtract the specified value from the X Axis of this Vector3 / Vector2
SubtractY(float) This Vector3 / Vector2 Subtract the specified value from the Y Axis of this Vector3 / Vector2
SubtractZ(float) This Vector3 Subtract the specified value from the Z Axis of this Vector3

Multiply

Multiply method Return Description
Multiply(Vector3 / Vector2) This Vector3 / Vector2 Multiply the Axis of this Vector3 / Vector2 with the corresponding Axis of another Vector3 / Vector2 and return the result
MultiplyX(Vector3 / Vector2) This Vector3 / Vector2 Multiply the X Axis of this Vector3 / Vector2 with the X Axis of another Vector3 and return the result
MultiplyY(Vector3 / Vector2) This Vector3 / Vector2 Multiply the Y Axis of this Vector3 / Vector2 with the Y Axis of another Vector3 and return the result
MultiplyZ(Vector3) This Vector3 Multiply the Z Axis of this Vector3 with the Z Axis of another Vector3 and return the result
Multiply(float, float, *float) This Vector3 / Vector2 Multiply the specified values with the Axis of this Vector3 / Vector2
MultiplyX(float) This Vector3 / Vector2 Multiply the specified value with the X Axis of this Vector3 / Vector2
MultiplyY(float) This Vector3 / Vector2 Multiply the specified value from the Y Axis of this Vector3 / Vector2
MultiplyZ(float) This Vector3 Multiply the specified value from the Z Axis of this Vector3

Divide

Divide method Return Description
Divide(Vector3 / Vector2) This Vector3 / Vector2 Divide the Axis of this Vector3 / Vector2 by the corresponding Axis of another Vector3 / Vector2 and return the result
DivideX(Vector3 / Vector2) This Vector3 / Vector2 Divide the X Axis of this Vector3 / Vector2 by the X Axis of another Vector3 / Vector2 and return the result
DivideY(Vector3 / Vector2) This Vector3 / Vector2 Divide the X Axis of this Vector3 / Vector2 by the X Axis of another Vector3 / Vector2 and return the result
DivideZ(Vector3) This Vector3 Divide the X Axis of this Vector3 by the X Axis of another Vector3 and return the result
Dividey(float, float, *float) This Vector3 / Vector2 Divide the specified values by the Axis of this Vector3 / Vector2
DivideX(float) This Vector3 / Vector2 Divide the specified value from the X Axis of this Vector3 / Vector2
DivideY(float) This Vector3 / Vector2 Divide the specified value from the Y Axis of this Vector3 / Vector2
DivideZ(float) This Vector3 Divide the specified value from the Z Axis of this Vector3

Compare

Compare method Return Description
Compare(Vector3 / Vector2, ?float) Bool Compare two Vector3 / Vector2 with an optional margin for floating-point precision
CompareX(Vector3 / Vector2, ?float) Bool Compare the X axis of two Vector3 / Vector2 with an optional margin for floating-point precision
CompareY(Vector3 / Vector2, ?float) Bool Compare the Y axis of two Vector3 / Vector2 with an optional margin for floating-point precision
CompareZ(Vector3, ?float) Bool Compare the Z axis of two Vector3 / Vector2 with an optional margin for floating-point precision
CompareX(float, ?float) Bool Compare a float value with the X Axis of this Vector3 / Vector2 with an optional margin for floating-point precision
CompareY(float, ?float) Bool Compare a float value with the Y Axis of this Vector3 / Vector2 with an optional margin for floating-point precision
CompareZ(float, ?float) Bool Compare a float value with the Z Axis of this Vector3 / Vector2 with an optional margin for floating-point precision

Randomize

Randomize method Return Description
Randomize(Vector2, Vector2, Vector2) This Vector3 / Vector2 Randomize the X & Y (& Z) axis of this Vector3 / Vector2 within specified ranges
Randomize(Vector2) This Vector3 / Vector2 Randomize the X & Y (& Z) axis of this Vector3 / Vector2 within the specified range
RandomizeUniform(Vector2) This Vector3 / Vector2 Randomize all axis of this Vector3 / Vector2 with the same random number within the specified range
RandomizeX(Vector2) This Vector3 / Vector2 Randomize the X axis of this Vector3 / Vector2 within a specified range
RandomizeY(Vector2) This Vector3 / Vector2 Randomize the Y axis of this Vector3 / Vector2 within a specified range
RandomizeZ(Vector2) This Vector3 / Vector2 Randomize the Z axis of this Vector3 within a specified range

Invert

Invert method Return Description
Invert() This Vector3 / Vector2 Invert all axis of this Vector3 / Vector2
InvertX() This Vector3 / Vector2 Invert the X axis of this Vector3 / Vector2
InvertY() This Vector3 / Vector2 Invert the Y axis of this Vector3 / Vector2
InvertZ() This Vector3 / Vector2 Invert the X axis of this Vector3

Midpoint

Midpoint method Return Description
Midpoint(Vector3 / Vector2) New Vector3 / Vector2 Calculate the midpoint between two Vector3 / Vector2
WeightedAverage(Vector3 / Vector2, float) New Vector3 / Vector2 Calculate the weighted average of two Vector3 / Vector2 based on specified weight

IsWithinRange

IsWithinRange method Return Description
IsWithinRange(Vector3 / Vector2, float) Bool Checks if this Vector3 / Vector2 is within the specified range of another Vector3 / Vector2
IsXWithinRange(Vector3 / Vector2, float) Bool Checks if the X Axis of this Vector3 / Vector2 is within the specified range of the X Axis of another Vector3 / Vector2
IsYWithinRange(Vector3 / Vector2, float) Bool Checks if the Y Axis of this Vector3 / Vector2 is within the specified range of the X Axis of another Vector3 / Vector2
IsZWithinRange(Vector3, float) Bool Checks if the Z Axis of this Vector3 is within the specified range of the X Axis of another Vector3

Source

You want to see how it works VectorExtensions.cs.

⚠️ **GitHub.com Fallback** ⚠️