This question was
closed Jul 15, 2017 at 04:14 PM by
tmckee for the following reason:
I gave up and dont care enough to wait for moderation
Question by
tmckee · Jul 17, 2017 at 04:40 AM ·
rigidbody2dmovement script
Rigidbody2d.AddForce wont move character
using UnityEngine;
using System.Collections;
public class movement : MonoBehaviour {
public float speed;
private Rigidbody2D rb2d;
void Start(){
rb2d = GetComponent<Rigidbody2D> ();
}
void FixedUpdate(){
float moveHorizontal = Input.GetAxisRaw ("Horizontal");
float moveVertical = Input.GetAxisRaw ("Vertical");
Vector2 movement = new Vector2(moveHorizontal, moveVertical);
print (movement);
rb2d.AddForce(movement * speed);
}
}
I have no idea why its not working. The rigidbody is referencing the player object. FixedUpdate shows me pressing the buttons in the console. Player is set to isKinematic. Im probably going to feel like an idiot when I fix this but I cant figure it out :(
Comment