Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ScrollMovement : MonoBehaviour
- {
- public GameObject top;
- public GameObject bottom;
- public float disntance = 5;
- private void FixedUpdate()
- {
- double value = Input.GetAxis("Mouse ScrollWheel");
- Debug.Log(value);
- if (value > 0f)
- {
- transform.position = Vector3.MoveTowards(transform.position, top.transform.position, disntance);
- }
- if (value < 0f)
- {
- transform.position = Vector3.MoveTowards(transform.position, bottom.transform.position, disntance);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment