Table of Contents
Ever wanted to only look at on a specific axis?
This code is here just to do that.
- Set a specific axis to look at your target.
- Open Unity and add a Cube to the scene and rename it to Head.
- Attach the LookAtAxisController.cs script to the Head as a component.
- Add another Cube to the scene and name it to LookAtTarget.
- Click on Head in the hierarchy.
- Drag the LookAtTarget in the Hierarchy on to the Target section in the inspector.
- Select an axis to specificy the direction to look at.
- Press Play in your editor, move around the Target and see the magic of LookAtAxisController.
- All axis is the same as the normal Look At function.