-3
this asim
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
void Awack()
{
floorMask = LayerMask.GetMask ("Floor");
anim = getComponet <Animator> ();
playerRigidbody = GetComponent <Rigidbody> ();
}
void FixedUpdate ()
{
float h = Input.GetAxisRaw ("horizontal");
float v = Input.GetAxisRaw ("vertical");
Move (h, v);
Turning ();
animating (h, v);
}
void (float h, float v)
{
movement.Ser(h,0f,v);
movement = movement.normalized * speed * Time.deltatime;
playerRigidbody.MoviPosition (transform.position + movement);
}
void Turnig ()
{
Ray camRay = Camera.main.screenPointToRay(Input.mousePosition);
RaycastHit floorHit;
if(Physics.Raycast(camRay,out floorHit.camRayLenght.floorMask))
{
Vector3 playerToMouse = floorHit.point - transform.position;
playerToMouse.y = 0f;
Quaternion newrotation = Quaternion.LookRotation(playerToMouse);
playerRigidbody.MoveRotation(newrotation);
}
}
void animating(float h,float v)
{
bool walking = h != 0f.v!=0f;
anim.SetBool("IsWalking",walking);
}
}
@Mauricio-s-c-vedoy, Welcome to Stackoverflow PT (SOPT) make a tour to understand the best way to ask and answer.
– Erlon Charles
If you are going to post here every minimal typo mistake you find it will get hard to help you. This I even understand that it’s not so obvious but post error because one is missing
;
is exaggerated.– Maniero
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero