The code i made is the following:
using UnityEngine;
public class Player : MonoBehaviour
{
public GameObject projectilePrefab;
public Transform wandTip;
Vector3 movementInput;
public Rigidbody playerRB;
public Transform playerGO;
public float playerSpeed;
Vector2 mousePos;
Vector2 mousePosInWorld;
Vector3 pointToLookAt;
public Camera mainCam;
void Start()
{
}
void Update()
{
movementInput = new Vector3 (Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
mousePos = Input.mousePosition;
mousePosInWorld = mainCam.ScreenToWorldPoint(mousePos);
print(mousePosInWorld);
//pointToLookAt = new Vector3(mousePosInWorld.x, playerGO.transform.position.y, mousePosInWorld.y);
//print(pointToLookAt) ;
}
void FixedUpdate()
{
playerRB.MovePosition(playerRB.position + movementInput * playerSpeed * Time.fixedDeltaTime);
//playerGO.LookAt(pointToLookAt);
}
}
Instead of telling me where the mouse position as a world point is, it tells me the camera x and y coordinates…
Im a noob dont flame me please and thank you