Code build error in Unity

Asked

Viewed 454 times

-3

SS

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);





    }

}
  • 2

    @Mauricio-s-c-vedoy, Welcome to Stackoverflow PT (SOPT) make a tour to understand the best way to ask and answer.

  • 1

    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.

  • 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?

1 answer

2

It gets hard to help with just this but one thing that’s definitely wrong is this: bool walking = h != 0f.v!=0f;. This particular problem probably solves so:

void animating(float h, float v) => anim.SetBool("IsWalking", h != 0f || v != 0f);

I put in the Github for future reference.

The code is poorly organized and makes it difficult to read.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.