Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CamMove : MonoBehaviour
- {
- [SerializeField]
- float speed = 5f;
- [SerializeField]
- float x, y;
- Rigidbody2D rb;
- void Start()
- {
- rb = GetComponent<Rigidbody2D>();
- }
- void Update()
- {
- x = Input.GetAxis("Horizontal") * speed;
- y = Input.GetAxis("Vertical") * speed;
- rb.velocity = new Vector2(x, y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement