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 rotate : MonoBehaviour
- {
- // Start is called before the first frame update
- [SerializeField]
- private GameObject player;
- [SerializeField]
- private Collider floorCollider;
- void FixedUpdate()
- {
- Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
- RaycastHit hitInfo;
- if (floorCollider.Raycast(ray, out hitInfo, Mathf.Infinity)){
- hitInfo.point = new Vector3(hitInfo.point.x, player.transform.position.y, hitInfo.point.z);
- transform.LookAt(hitInfo.point);
- }
- else { Debug.Log("Nie widzisz podlogi"); }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement