Show / Hide Table of Contents

Class TransformUtilities

Contains many utility functions related to transforms

Inheritance
object
TransformUtilities
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public static class TransformUtilities

Methods

| Edit this page View Source

GetHashOfTransform(Transform, bool)

Gets a hash of the transform and it's hiearchy

Declaration
public static int GetHashOfTransform(Transform transform, bool includeChildren = true)
Parameters
Type Name Description
Transform transform

The transform to check

bool includeChildren

Should child objects also be included in the hash?

Returns
Type Description
int

Returns the hash of the transform's hiearchy

| Edit this page View Source

GetLocalScaleXY(Transform)

Gets the local scale of the transform in the XY plane.

Declaration
public static Vector2 GetLocalScaleXY(this Transform transform)
Parameters
Type Name Description
Transform transform

The transform to retrieve the local scale from.

Returns
Type Description
Vector2

The local scale of the transform in the XY plane.

| Edit this page View Source

GetXLocalPosition(Transform)

Gets the local x position of a transform

Declaration
public static float GetXLocalPosition(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetXLocalRotation(Transform)

Gets the local x rotation of a transform

Declaration
public static float GetXLocalRotation(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetXLocalScale(Transform)

Gets the local x scale of a transform

Declaration
public static float GetXLocalScale(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetXPosition(Transform)

Gets the x position of a transform

Declaration
public static float GetXPosition(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetXRotation(Transform)

Gets the x rotation of a transform

Declaration
public static float GetXRotation(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetYLocalPosition(Transform)

Gets the local y position of a transform

Declaration
public static float GetYLocalPosition(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetYLocalRotation(Transform)

Gets the local y rotation of a transform

Declaration
public static float GetYLocalRotation(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetYLocalScale(Transform)

Gets the local y scale of a transform

Declaration
public static float GetYLocalScale(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetYPosition(Transform)

Gets the y position of a transform

Declaration
public static float GetYPosition(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetYRotation(Transform)

Gets the y rotation of a transform

Declaration
public static float GetYRotation(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetZLocalPosition(Transform)

Gets the local z position of a transform

Declaration
public static float GetZLocalPosition(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetZLocalRotation(Transform)

Gets the local z rotation of a transform

Declaration
public static float GetZLocalRotation(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetZLocalScale(Transform)

Gets the local z scale of a transform

Declaration
public static float GetZLocalScale(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetZPosition(Transform)

Gets the z position of a transform

Declaration
public static float GetZPosition(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

GetZRotation(Transform)

Gets the z rotation of a transform

Declaration
public static float GetZRotation(this Transform transform)
Parameters
Type Name Description
Transform transform
Returns
Type Description
float
| Edit this page View Source

JitterObject(GameObject, Vector3, float)

Will rapidly jitter an object until the coroutine gets cancelled

Declaration
public static IEnumerator JitterObject(GameObject gameObject, Vector3 amount, float jitterFPS = Infinity)
Parameters
Type Name Description
GameObject gameObject

The object to jitter

Vector3 amount

The amount of jitter to be applied

float jitterFPS

How fast the jitter should be applied

Returns
Type Description
IEnumerator
| Edit this page View Source

JitterObject(Transform, Vector3, float)

Will rapidly jitter an object until the coroutine gets cancelled

Declaration
public static IEnumerator JitterObject(Transform transform, Vector3 amount, float jitterFPS = Infinity)
Parameters
Type Name Description
Transform transform

The transform to jitter

Vector3 amount

The amount of jitter to be applied

float jitterFPS

How fast the jitter should be applied

Returns
Type Description
IEnumerator
| Edit this page View Source

SetLocalPosition(Transform, float, float, float)

Sets the local position of the transform

Declaration
public static Vector3 SetLocalPosition(this Transform transform, float x = NaN, float y = NaN, float z = NaN)
Parameters
Type Name Description
Transform transform

The transform to set

float x

The new local x-position to set. If it's set to NaN, it will leave it unchanged

float y

The new local y-position to set. If it's set to NaN, it will leave it unchanged

float z

The new local z-position to set. If it's set to NaN, it will leave it unchanged

Returns
Type Description
Vector3

Returns the new local position that has just been set

| Edit this page View Source

SetLocalRotation(Transform, float, float, float)

Sets the local rotation of the transform

Declaration
public static Vector3 SetLocalRotation(this Transform transform, float x = NaN, float y = NaN, float z = NaN)
Parameters
Type Name Description
Transform transform

The transform to set

float x

The new local x-rotation to set. If it's set to NaN, it will leave it unchanged

float y

The new local y-rotation to set. If it's set to NaN, it will leave it unchanged

float z

The new local z-rotation to set. If it's set to NaN, it will leave it unchanged

Returns
Type Description
Vector3

Returns the new local rotation that has just been set

| Edit this page View Source

SetLocalScaleXY(Transform, float, float)

Sets the local scale of the transform in the XY plane using individual components.

Declaration
public static void SetLocalScaleXY(this Transform transform, float x, float y)
Parameters
Type Name Description
Transform transform

The transform to set the local scale for.

float x

The new local scale along the X-axis.

float y

The new local scale along the Y-axis.

| Edit this page View Source

SetLocalScaleXY(Transform, Vector2)

Sets the local scale of the transform in the XY plane.

Declaration
public static void SetLocalScaleXY(this Transform transform, Vector2 value)
Parameters
Type Name Description
Transform transform

The transform to set the local scale for.

Vector2 value

The new local scale in the XY plane.

| Edit this page View Source

SetPosition(Transform, float, float, float)

Sets the position of the transform

Declaration
public static Vector3 SetPosition(this Transform transform, float x = NaN, float y = NaN, float z = NaN)
Parameters
Type Name Description
Transform transform

The transform to set

float x

The new x-position to set. If it's set to NaN, it will leave it unchanged

float y

The new y-position to set. If it's set to NaN, it will leave it unchanged

float z

The new z-position to set. If it's set to NaN, it will leave it unchanged

Returns
Type Description
Vector3

Returns the new position that has just been set

| Edit this page View Source

SetRotation(Transform, float, float, float)

Sets the rotation of the transform

Declaration
public static Vector3 SetRotation(this Transform transform, float x = NaN, float y = NaN, float z = NaN)
Parameters
Type Name Description
Transform transform

The transform to set

float x

The new x-rotation to set. If it's set to NaN, it will leave it unchanged

float y

The new y-rotation to set. If it's set to NaN, it will leave it unchanged

float z

The new z-rotation to set. If it's set to NaN, it will leave it unchanged

Returns
Type Description
Vector3

Returns the new rotation that has just been set

| Edit this page View Source

SetXLocalPosition(Transform, float)

Sets the local x position of a transform

Declaration
public static float SetXLocalPosition(this Transform transform, float newX)
Parameters
Type Name Description
Transform transform
float newX
Returns
Type Description
float
| Edit this page View Source

SetXLocalRotation(Transform, float)

Sets the local x rotation of a transform

Declaration
public static float SetXLocalRotation(this Transform transform, float newX)
Parameters
Type Name Description
Transform transform
float newX
Returns
Type Description
float
| Edit this page View Source

SetXLocalScale(Transform, float)

Sets the local x scale of a transform

Declaration
public static float SetXLocalScale(this Transform transform, float newX)
Parameters
Type Name Description
Transform transform
float newX
Returns
Type Description
float
| Edit this page View Source

SetXPosition(Transform, float)

Sets the x position of a transform

Declaration
public static float SetXPosition(this Transform transform, float newX)
Parameters
Type Name Description
Transform transform
float newX
Returns
Type Description
float
| Edit this page View Source

SetXRotation(Transform, float)

Sets the x rotation of a transform

Declaration
public static float SetXRotation(this Transform transform, float newX)
Parameters
Type Name Description
Transform transform
float newX
Returns
Type Description
float
| Edit this page View Source

SetYLocalPosition(Transform, float)

Sets the local y position of a transform

Declaration
public static float SetYLocalPosition(this Transform transform, float newY)
Parameters
Type Name Description
Transform transform
float newY
Returns
Type Description
float
| Edit this page View Source

SetYLocalRotation(Transform, float)

Sets the local y rotation of a transform

Declaration
public static float SetYLocalRotation(this Transform transform, float newY)
Parameters
Type Name Description
Transform transform
float newY
Returns
Type Description
float
| Edit this page View Source

SetYLocalScale(Transform, float)

Sets the local y scale of a transform

Declaration
public static float SetYLocalScale(this Transform transform, float newY)
Parameters
Type Name Description
Transform transform
float newY
Returns
Type Description
float
| Edit this page View Source

SetYPosition(Transform, float)

Sets the y position of a transform

Declaration
public static float SetYPosition(this Transform transform, float newY)
Parameters
Type Name Description
Transform transform
float newY
Returns
Type Description
float
| Edit this page View Source

SetYRotation(Transform, float)

Sets the y rotation of a transform

Declaration
public static float SetYRotation(this Transform transform, float newY)
Parameters
Type Name Description
Transform transform
float newY
Returns
Type Description
float
| Edit this page View Source

SetZLocalPosition(Transform, float)

Sets the local z position of a transform

Declaration
public static float SetZLocalPosition(this Transform transform, float newZ)
Parameters
Type Name Description
Transform transform
float newZ
Returns
Type Description
float
| Edit this page View Source

SetZLocalRotation(Transform, float)

Sets the local z rotation of a transform

Declaration
public static float SetZLocalRotation(this Transform transform, float newZ)
Parameters
Type Name Description
Transform transform
float newZ
Returns
Type Description
float
| Edit this page View Source

SetZLocalScale(Transform, float)

Sets the local z scale of a transform

Declaration
public static float SetZLocalScale(this Transform transform, float newZ)
Parameters
Type Name Description
Transform transform
float newZ
Returns
Type Description
float
| Edit this page View Source

SetZPosition(Transform, float)

Sets the z position of a transform

Declaration
public static float SetZPosition(this Transform transform, float newZ)
Parameters
Type Name Description
Transform transform
float newZ
Returns
Type Description
float
| Edit this page View Source

SetZRotation(Transform, float)

Sets the z rotation of a transform

Declaration
public static float SetZRotation(this Transform transform, float newZ)
Parameters
Type Name Description
Transform transform
float newZ
Returns
Type Description
float
| Edit this page View Source

SpawnRandomObjects(GameObject, Vector3, int, int, float, float, float, float, Vector2)

Spawns a bunch of new objects. The quantity, rigidbody velocity, velocity angle, and spawn origin are all randomized

Declaration
public static GameObject[] SpawnRandomObjects(GameObject obj, Vector3 spawnPoint, int quantityMin, int quantityMax, float minVelocity, float maxVelocity, float angleMin, float angleMax, Vector2 originOffset = default)
Parameters
Type Name Description
GameObject obj

The object to spawn

Vector3 spawnPoint

The place where all the objects will spawn

int quantityMin

The minimum amount of objects to spawn

int quantityMax

The maximum amount of objects to spawn

float minVelocity

The minimum velocity to be applied to each object

float maxVelocity

The maximum amount of velocity to be applied to each object

float angleMin

The minimum velocity angle to be applied to each object

float angleMax

The maximum velocity angle to be applied to each object

Vector2 originOffset

How far away can objects spawn from the spawnPoint

Returns
Type Description
GameObject[]

Returns a list of all the objects that have been spawned

| Edit this page View Source

SpawnRandomObjects(ObjectPool, Vector3, int, int, float, float, float, float, Vector2)

Spawns a bunch of new objects. The quantity, rigidbody velocity, velocity angle, and spawn origin are all randomized

Declaration
public static GameObject[] SpawnRandomObjects(ObjectPool pool, Vector3 spawnPoint, int quantityMin, int quantityMax, float minVelocity, float maxVelocity, float angleMin, float angleMax, Vector2 originOffset = default)
Parameters
Type Name Description
ObjectPool pool

The pool to spawn the objects from

Vector3 spawnPoint

The place where all the objects will spawn

int quantityMin

The minimum amount of objects to spawn

int quantityMax

The maximum amount of objects to spawn

float minVelocity

The minimum velocity to be applied to each object

float maxVelocity

The maximum amount of velocity to be applied to each object

float angleMin

The minimum velocity angle to be applied to each object

float angleMax

The maximum velocity angle to be applied to each object

Vector2 originOffset

How far away can objects spawn from the spawnPoint

Returns
Type Description
GameObject[]

Returns a list of all the objects that have been spawned

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾