Quoted By:
I'm trying to figure out why my character isn't moving. I've followed multiple tutorials online with no success. My character never moves.
Can I get some help with what is going on?
When I put in rb.velocity = new Vector2(horizontal, vertical); it strikes a line through velocity, or force updates to "angularVelocity" and nothing moves. Using Unity 6.2. What's going on?
Error CS0029: Cannot implicitly convert type 'UnityEngine.Vector2' to 'float'
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
public float speed = 5;
public Rigidbody2D rb;
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
rb.velocity = new Vector2(horizontal, vertical);
}
}
Can I get some help with what is going on?
When I put in rb.velocity = new Vector2(horizontal, vertical); it strikes a line through velocity, or force updates to "angularVelocity" and nothing moves. Using Unity 6.2. What's going on?
Error CS0029: Cannot implicitly convert type 'UnityEngine.Vector2' to 'float'
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
public float speed = 5;
public Rigidbody2D rb;
void Update()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
rb.velocity = new Vector2(horizontal, vertical);
}
}
