Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Error that I can't find in my code

$
0
0
I used a guide video to make this and the Error is: **Assets/Scripts/Player/PlayerMovement.cs(42,26): error CS1525: Unexpected symbol `RaycastHit'** Heres my code: using UnityEngine; public class PlayerMovement : MonoBehaviour { public float speed =6f; Vector3 movement; Animator anim; Rigidbody playerRigidbody; int floorMask; float camRayLength = 100f; void Awake() { floorMask = LayerMask.GetMask ("Floor"); anim = GetComponent (); playerRigidbody = GetComponent (); } void FixedUpdate() { float h = Input.GetAxisRaw("Horizontal"); float v = Input.GetAxisRaw("Vertical"); Move (h, v); Turning (); Animating (h, v); } void Move (float h, float v) { movement.Set (h, 0f, v); movement = movement.normalized * speed * Time.deltaTime; playerRigidbody.MovePosition (transform.position + movment); } void Turning() { Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition) RaycastHit FloorHit; if(Physics.Raycast (camRay, out floorHit, camRayLength, 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); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>