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 CamScript : MonoBehaviour
- {
- public Transform target;
- public float smoothSpeed = 0.125f;
- public Vector3 offset;
- private Camera mainCamera;
- //private Mouse mousePosition;
- void Start()
- {
- mainCamera = FindObjectOfType<Camera>();
- mainCamera = Camera.main;
- }
- void Update()
- {
- var mousePosition = new Vector3(Input.mousePosition.x/Screen.width, Input.mousePosition.y/Screen.height, 0f);
- //mousePosition.normalized = new Vector3(Input.mousePosition.x/Screen.width, Input.mousePosition.y/Screen.height, 0f);
- Ray cameraRay = mainCamera.ScreenPointToRay(Input.mousePosition);
- Plane groundPlane = new Plane(Vector3.up, Vector3.zero);
- transform.position(target.position + Camera.main.right * (mousePosition.normalized.x - 0.5f) + GetComponent<Camera>().up * (mousePosition.normalized.y - 0.5f));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement