Мой код для камеры от третьего лица и движения вызывает ошибку, и я не знаю, почему ⇐ C#
Мой код для камеры от третьего лица и движения вызывает ошибку, и я не знаю, почему
I've recently embarked on the journey of game development and, as i'm sure many have, ran across Brackeys' videos. I watched and did as he said for his "THIRD PERSON MOVEMENT in Unity" video, and I keep getting an error "Assets\ThirdPersonMovement.cs(13,29): error CS1002: ; expected" along with me not being able to move or being able to put the main camera into the reference slot for my script. Here's my code |||| VVVV
using UnityEngine;
public class ThirdPersonMovement : MonoBehaviour {
public CharacterController cc; public Transform cam; public float speed = 6f; public float turnSmoothTime = 0.1f; float turnSmoothVelocity // Update is called once per frame void Update() { float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector3 dir = new Vector3(horizontal, 0f, vertical).normalized; if (dir.magnitude >= 0.1) { float targetAngle = Mathf.Atan2(dir.x, dir.z) * Mathf.Rad2Deg + cam.eulerAngles.y; float.angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, tagrgetAngle, ref turnSmoothVelocity, turnSmoothTime); transform.rotation = Quaternion.Euler(0f, Angle, 0f); Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forawrd; cc.Move(moveDir.normalized * speed * Time.deltaTime); } } }
I went through the code in his video and other's code in the comments but none of it fixes it.
Источник: https://stackoverflow.com/questions/781 ... nd-idk-why
I've recently embarked on the journey of game development and, as i'm sure many have, ran across Brackeys' videos. I watched and did as he said for his "THIRD PERSON MOVEMENT in Unity" video, and I keep getting an error "Assets\ThirdPersonMovement.cs(13,29): error CS1002: ; expected" along with me not being able to move or being able to put the main camera into the reference slot for my script. Here's my code |||| VVVV
using UnityEngine;
public class ThirdPersonMovement : MonoBehaviour {
public CharacterController cc; public Transform cam; public float speed = 6f; public float turnSmoothTime = 0.1f; float turnSmoothVelocity // Update is called once per frame void Update() { float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); Vector3 dir = new Vector3(horizontal, 0f, vertical).normalized; if (dir.magnitude >= 0.1) { float targetAngle = Mathf.Atan2(dir.x, dir.z) * Mathf.Rad2Deg + cam.eulerAngles.y; float.angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, tagrgetAngle, ref turnSmoothVelocity, turnSmoothTime); transform.rotation = Quaternion.Euler(0f, Angle, 0f); Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forawrd; cc.Move(moveDir.normalized * speed * Time.deltaTime); } } }
I went through the code in his video and other's code in the comments but none of it fixes it.
Источник: https://stackoverflow.com/questions/781 ... nd-idk-why
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как добавить переменную высоту прыжка в сценарий контроллера от третьего лица?
Anonymous » » в форуме C# - 0 Ответы
- 59 Просмотры
-
Последнее сообщение Anonymous
-