- Home /
 
               Question by 
               TygoW · Jan 30, 2018 at 06:19 PM · 
                scripting problemplayerscript.scripting beginnerscripterror  
              
 
              Why does my player not move?
I have a script that i think is correct but when i attach it to my player nothing happens. Can someone please help me?
This is my script
 public float speed; 
 private Rigidbody2D rb;
 private Vector2 moveVelocity; 
 void Start(){
     rb = GetComponent<Rigidbody2D>();        
 }
 void Update(){
     Vector2 moveInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
     moveVelocity = moveInput.normalized * speed;
 }
 void FixedUdate(){
     rb.MovePosition(rb.position + moveVelocity * Time.fixedDeltaTime);        
 }
}
               Comment
              
 
               
              Answer by yummy81 · Jan 30, 2018 at 06:56 PM
You missed the letter "p" in FixedUpdate :)
it should be:
 void FixedUpdate(){
      rb.MovePosition(rb.position + moveVelocity * Time.fixedDeltaTime);        
  }
 
besides that, everything works fine.
Your answer
 
 
             Follow this Question
Related Questions
GetComponent won't work 1 Answer
How Do I rotate a Object Based On the player's location? 1 Answer
IEnumerator Loop on keypress 1 Answer
Pong goal collision 3 Answers
How to tell if a Canvas UI slider is being clicked not over Value 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                