Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using MoreMountains.CorgiEngine;
- using MoreMountains.Tools;
- public class AimWeaponAtGameObject : MonoBehaviour
- {
- [SerializeField] WeaponAim weaponAim;
- public GameObject aimObj;
- // Start is called before the first frame update
- void Start()
- {
- weaponAim = GetComponent<WeaponAim>();
- }
- // Update is called once per frame
- void Update()
- {
- // this function does some math based on the transform of the gun
- //which is a parent of the enemy so we need to translate the players position to account with that;
- Vector3 aimVector = transform.InverseTransformPoint(aimObj.transform.position);
- weaponAim.SetCurrentAim(aimVector);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement