Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

me ajudem por favor.......erro do compilador cs 1002: ; expected

Discussion in 'Scripting' started by nandonandoxx, May 14, 2020.

  1. nandonandoxx

    nandonandoxx

    Joined:
    Mar 1, 2020
    Posts:
    2
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class playermovement : MonoBehaviour
    {
    public float turnspeed = 20f;

    Animator m_Animator;
    Rigidbody m_Rigidbody;
    vector3 m_Movement;
    Quaternion m_Rotation = Quaternion.identy;

    // Start is called before the first frame update
    void Start()

    {

    m_Animator = GetComponent<Animator> ();
    m_Rigidbody = GetComponent<Rigidbody> ();
    }

    // Update is called once per frame
    void FixedUpdate()

    {
    float horizontal = Input Get.Axis ("horizontal");
    float vertical = Input Get.Axis ("vertical");

    m_Movement.Set(horizontal, 0F, vertical);
    m_Movement.Normalize ();

    bool hasHorizontalInput = !Mathf.Approximately (horizontal, 0F);
    bool hasHorizontalInput = !Mathf.Approximately (vertical, 0F);
    bool IsWalking = hasHorizontalInput || hasVerticalInput;
    m_Animator.SetBool ("IsWalking", isWalking);

    vector3 desiredforward = vector3.RotateTowards (transform.foward m_Movement, turnspeed * Time.deltatime, 0F);
    m_Rotation = Quaternion.LookRotation (desiredforward);
    }

    void OnAnimatormove()
    {

    m_Rigidbody.moveposition (m_Rigidbody.position + m_Movement * m_Animator.deltaposition.magnitude);
    m_Rigidbody.moveRotation (m_Rotation);
    }
    }
     
  2. pinksheep8426

    pinksheep8426

    Joined:
    Jul 2, 2016
    Posts:
    5
    For the love of god please actually check your code before posting here
    Por el amor de Dios, por favor revise su código antes de publicar aquí

    vector3 -> Vector3
    Quaternion.identy -> Quaternion.identity
    Input Get.Axis -> Input.GetAxis //This fixes your issue btw

    bool hasHorizontalInput = !Mathf.Approximately(horizontal, 0F);
    bool hasHorizontalInput = !Mathf.Approximately(vertical, 0F);
    to
    bool hasHorizontalInput = !Mathf.Approximately(horizontal, 0F);
    bool hasVerticalInput= !Mathf.Approximately(vertical, 0F);

    IsWalking -> isWalking

    vector3 desiredforward = vector3.RotateTowards(transform.foward m_Movement, turnspeed * Time.deltatime, 0F);
    to
    Vector3 desiredforward = vector3.RotateTowards(transform.forward, m_Movement, turnspeed * Time.deltaTime, 0F);

    moveposition -> MovePosition
    moveRotation -> MoveRotation