This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| public class WeaponSway : MonoBehaviour | |
| { | |
| [SerializeField] private Transform weaponTransform; | |
| [Header("Sway Properties")] | |
| [SerializeField] private float swaySmooth = 8f; | |
| [SerializeField] private float swayDamp = 2f; | |
| [SerializeField] private float posToRotAmount = 1f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| /// <summary> | |
| /// Small helper class to convert viewport, screen or world positions to canvas space. | |
| /// Only works with screen space canvases. | |
| /// </summary> | |
| /// <example> | |
| /// <code> | |
| /// objectOnCanvasRectTransform.anchoredPosition = specificCanvas.WorldToCanvasPoint(worldspaceTransform.position); | |
| /// </code> |