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

(39,41): error CS0029: Cannot implicitly convert type 'float' to 'UnityEngine.Vector3'

$
0
0
HI, I'm new to unity, I'm following an fps tutorial and get this error. Here is my code. `using System.Collections; using System.Collections.Generic; using System.Security.Cryptography; using UnityEngine; public class PlayerMove : MonoBehaviour { float moveForward; float moveSide; float moveUp; public float speed = 5f; public float jumpSpeed = 10f; Rigidbody rig; bool isGrounded; // Start is called before the first frame update void Start() { rig = GetComponent(); } // Update is called once per frame void Update() { moveForward = Input.GetAxis("Vertical") * speed; moveSide = Input.GetAxis("Horizontal") * speed; moveUp = Input.GetAxis("Jump") * jumpSpeed; rig.velocity = (transform.forward * moveForward) + (transform.right * moveSide) + (transform.up * rig.velocity.y); if(isGrounded && moveUp != 0) { rig.AddForce(transform.up = moveUp, ForceMode.VelocityChange); isGrounded = false; } } private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Gtound") isGrounded = true; } private void OnCollisionExit(Collision collision) { if (collision.gameObject.tag == "Gtound") isGrounded = false; } } `

Viewing all articles
Browse latest Browse all 2891

Trending Articles