namespace: CurveArchitect.Utilites
file: HelperArchitectCurveObject.cs
General
ArchitectCurveObject CreateDeformation(ArchitectCurve ac, GameObject go, Vector3 localCurvePosition)
Description:
Creates and sets up an ArchitectCurveObject for deformation on the specified ArchitectCurve.
Params:
- ac: The ArchitectCurve to which the deformation object will be added.
- go: The GameObject that will be turned into an ArchitectCurveObject for deformation.
- localCurvePosition: The initial position of the object relative to the curve.
Returns:
The created ArchitectCurveObject configured for deformation.
ArchitectCurveObject CreateFollower(ArchitectCurve ac, GameObject go, Vector3 localCurvePosition)
Description:
Creates and sets up an ArchitectCurveObject as a follower on the specified ArchitectCurve.
Params:
- ac: The ArchitectCurve to which the follower object will be added.
- go: The GameObject that will be turned into an ArchitectCurveObject for following.
- localCurvePosition: The initial position of the object relative to the curve.
Returns:
The created ArchitectCurveObject configured as a follower.
void DetachToWorld(ArchitectCurveObject aco, bool setParentToNull = true)
Description:
Detaches an ArchitectCurveObject from its parent ArchitectCurve and updates its position and rotation to world space.
Params:
- aco: The ArchitectCurveObject to be detached.
- setParentToNull: Indicates whether the object's parent should be set to null. Default is true.
void DetachToLocal(ArchitectCurveObject aco)
Description:
Detaches an ArchitectCurveObject to maintain its position and rotation in local space, useful for handling hierarchies where objects are deformed within other deformations.
Params:
- aco: The ArchitectCurveObject to be detached.
void DetachAndDestroy(ArchitectCurveObject aco, Space space)
Description:
Detaches an ArchitectCurveObject from its parent ArchitectCurve and destroys it, preserving its position and rotation based on the specified space.
Params:
- aco: The ArchitectCurveObject to be detached and destroyed.
- space: The space (World or Local) in which to preserve the object's position and rotation before destruction.
void ConvertToFollower(ArchitectCurveObject aco)
Description:
Converts an ArchitectCurveObject to a follower type, updating its state and adding it to the follower update list of its parent ArchitectCurve.
Params:
- aco: The ArchitectCurveObject to be converted to a follower.
void ConvertToDeformation(ArchitectCurveObject aco, bool initalizeMeshContainers = true)
Description:
Converts an ArchitectCurveObject to a deformation type, optionally initializing its mesh containers and performing runtime deformation.
Params:
- aco: The ArchitectCurveObject to be converted to a deformation.
- initalizeMeshContainers: Specifies whether the mesh containers should be initialized. Default is true.
void ChangeParent(ArchitectCurveObject aco, Transform newParent)
Description:
Changes the parent transform of an ArchitectCurveObject and updates its data and related properties.
Params:
- aco: The ArchitectCurveObject whose parent will be changed.
- newParent: The new parent transform for the ArchitectCurveObject.
void TransformToNewParent(ArchitectCurveObject aco)
Description:
Adjusts the local position and rotation of an ArchitectCurveObject to align with its new parent transform.
Params:
- aco: The ArchitectCurveObject to be transformed to its new parent.
void ReorderForParentHierarchy(ArchitectCurveObject aco)
Description:
Reorders an ArchitectCurveObject within its parent ArchitectCurve to ensure it is positioned directly after its parent ArchitectCurveObject in the hierarchy.
Params:
- aco: The ArchitectCurveObject to reorder within the parent hierarchy.
void InitalizeMeshContainersRunetime(ArchitectCurveObject aco, Component[] components = null)
Description:
Initializes mesh containers for an ArchitectCurveObject at runtime.
Params:
- aco: The ArchitectCurveObject for which to initialize mesh containers.
- components: Optional array of components to check for mesh filters and colliders. If null, components are retrieved from the ArchitectCurveObject.
void TryAttachPrimitiveColliders(ArchitectCurveObject aco, Component[] components = null)
Description:
Attempts to attach primitive colliders to an ArchitectCurveObject by checking its components.
Params:
- aco: The ArchitectCurveObject to which colliders will be attached.
- components: Optional array of components to check. If null, components are retrieved from the ArchitectCurveObject.
void CleanPrimitiveColliders(ArchitectCurveObject aco)
Description:
Cleans up the list of primitive colliders in an ArchitectCurveObject by removing any null references.
Params:
- aco: The ArchitectCurveObject whose primitive colliders will be cleaned.
void CalculatePrimitiveCollidersForDeformations(ArchitectCurveObject aco, bool useOriginMesh = false)
Description:
Calculates and updates the properties of primitive colliders (Box, Sphere, Capsule) in an ArchitectCurveObject based on its mesh bounds for deformations.
Params:
- aco: The ArchitectCurveObject whose colliders will be recalculated.
- useOriginMesh: Indicates whether to use the original mesh for calculations instead of the instance mesh. Default is false.
void CopyValues(ArchitectCurveObject acoFrom, ArchitectCurveObject acoTo)
Description:
Copies the properties and settings from one ArchitectCurveObject to another.
Params:
- acoFrom: The source ArchitectCurveObject from which values are copied.
- acoTo: The target ArchitectCurveObject to which values are copied.
ArchitectCurve TryFindArchitectCurve(Transform transform)
Description:
Attempts to find the nearest parent ArchitectCurve in the hierarchy from the given transform.
Params:
- transform: The starting transform from which to search upward in the hierarchy.
Returns:
The nearest ArchitectCurve found, or null if none is found within 25 levels up the hierarchy.
Bounds GetCombinedBounds(ArchitectCurveObject aco)
Description:
Calculates and returns the combined world bounds of all mesh containers in an ArchitectCurveObject.
Params:
- aco: The ArchitectCurveObject whose mesh containers are used to calculate the combined bounds.
Returns:
The combined world bounds of the meshes within the ArchitectCurveObject.
Vector3 GetCombinedParentPositions(ArchitectCurveObject acoParent)
Description:
Calculates the combined position of an ArchitectCurveObject's parent hierarchy by summing their local curve positions.
Params:
- acoParent: The ArchitectCurveObject whose parent hierarchy positions will be combined.
Returns:
The combined position of all parent ArchitectCurveObjects in the hierarchy.
Vector3 GetCombinedParentScales(ArchitectCurveObject acoParent)
Description:
Calculates the combined scale of an ArchitectCurveObject's parent hierarchy by multiplying their local scales.
Params:
- acoParent: The ArchitectCurveObject whose parent hierarchy scales will be combined.
Returns:
The combined scale of all parent ArchitectCurveObjects in the hierarchy.
Quaternion GetCombinedParentRotations(ArchitectCurveObject acoParent)
Description:
Calculates the combined rotation of an ArchitectCurveObject's parent hierarchy by multiplying their local rotations.
Params:
- acoParent: The ArchitectCurveObject whose parent hierarchy rotations will be combined.
Returns:
The combined rotation of all parent ArchitectCurveObjects in the hierarchy.
float4x4 GetCombinedParentMatrixs(ArchitectCurveObject aco)
Description:
Calculates the combined transformation matrix of an ArchitectCurveObject's parent hierarchy by multiplying their local transformation matrices.
Params:
- aco: The ArchitectCurveObject whose parent hierarchy matrices will be combined.
Returns:
The combined transformation matrix of all parent ArchitectCurveObjects in the hierarchy.
int GetCombinedParentHashCodes(ArchitectCurveObject aco)
Description:
Calculates the combined hash codes of an ArchitectCurveObject's parent hierarchy, summing the hash codes of each parent.
Params:
- aco: The ArchitectCurveObject whose parent hierarchy hash codes will be combined.
Returns:
The combined hash code of all parent ArchitectCurveObjects in the hierarchy.