Skip to main content
100%

Gist 1aef7ee80b94a5ba6afb087f89ef50aa

✓ Published0🌍 Public
Aandybak
Last edited Feb 25, 2021
Created on Feb 25, 2021

This example shows a Unity script that repositions an object’s parent so a tracked target aligns with a designated “feet” GameObject. It computes the offset vector between the feet and target, then subtracts that vector from the parent’s position to shift the entire hierarchy. The script runs automatically when the component is enabled, calling `MoveToTarget()` in `OnEnable`, and exposes the same method publicly for manual invocation. It uses Unity’s `Transform` API, including `position` and `transform.parent`, to perform the direct positional correction without physics or animation.

AI-generated description

Similar vizzes