Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BarrelMovement : MonoBehaviour
- {
- // Update is called once per frame
- void Update()
- {
- Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
- mousePosition = new Vector3(mousePosition.x, mousePosition.y, 0);
- Vector3 barrelPosition = transform.position;
- transform.up = mousePosition - barrelPosition;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement