Question by
kojunha · Oct 14, 2015 at 09:24 AM ·
movementcollidermovement scriptmovemove an object
My character doesn't move. How should I do?
using UnityEngine; using System.Collections;
public class Player_Controller : MonoBehaviour {
public float Speed = 50f;
public float JumpPower = 200;
public bool grounded;
void Start () {
}
void Update () {
}
void FixedUpdated () {
float h = Input.GetAxis("Horizontal");
GetComponent<Rigidbody2D>().AddForce((Vector2.right * Speed) * h);
}
} This is my code. And it doesn't make any error and warning text. But my Character doen't move. I set boxcoll on character and ground. And i dom't set is trigger... Plz Help me!!
제목-없음.png
(121.5 kB)
Comment
Answer by Erdroy · Oct 15, 2015 at 04:33 PM
You just have the movement in wrong method. "FixedUpdated"? Try: "FixedUpdate" ;)