Assets\Modelos3D\Personagens\ControlPlayer.cs(40,28): error CS1503: Argument 1: cannot convert from 'UnityEngine.Ray' to 'UnityEngine.Vector3'
Assets\Modelos3D\Personagens\ControlPlayer.cs(40,34): error CS1503: Argument 2: cannot convert from 'UnityEngine.RaycastHit' to 'UnityEngine.Vector3'
Assets\Modelos3D\Personagens\ControlPlayer.cs(40,34): error CS0165: Use of unassigned local variable 'impacto'
alem disso, o 'MascaraChao' nao esta aparecendo no inspetor
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControlPlayer : MonoBehaviour {
public float Velocidade = 10;
Vector3 direcao;
public LayerMask MascaraChao;
void Update () {
float eixoX = Input.GetAxis("Horizontal");
float eixoZ = Input.GetAxis("Vertical");
direcao = new Vector3(eixoX, 0, eixoZ);
if(direcao != Vector3.zero)
{
GetComponent<Animator>().SetBool("Movendo", true);
}
else
{
GetComponent<Animator>().SetBool("Movendo", false);
}
}
void FixedUpdate()
{
GetComponent<Rigidbody>().MovePosition
(GetComponent<Rigidbody>().position+
(direcao * Velocidade * Time.deltaTime));
Ray raio = Camera.main.ScreenPointToRay(Input.mousePosition);
Debug.DrawRay(raio.origin, raio.direction, Color.red);
RaycastHit impacto;
if(Physics.Raycast(raio, impacto, 100, MascaraChao))
{
Vector3 posicaoMiraMyriah = impacto.point - transform.position;
posicaoMiraMyriah.y = transform.position.y;
Quaternion novaRotacao = Quaternion.LookRotation(posicaoMiraMyriah);
GetComponent<Rigidbody>().MoveRotation(novaRotacao);
}
}
}