unity3d - Unity position y is escaping -


i started tutorial https://unity3d.com/learn/tutorials/projects/roll-a-ball/moving-the-player , don't understand why, after clicking play, position y automaticly, changing value. following tutorial , don't miss. efect ball after clicking play disappearing immediately..

maybe had similar problem?

using unityengine;  using system.collections; public class playercontroller : monobehaviour {  public float speed; private rigidbody rb;  // use initialization void start () {     rb = getcomponent<rigidbody>(); }  void fixedupdate() {     float movehorizontal = input.getaxis ("horizontal");     float movevertical = input.getaxis ("vertical");      vector3 movement = new vector3 (movehorizontal, 0.0f, movevertical);     rb.addforce (movement * speed); }} 

the player object's y-coordinate automatically changing means it's falling downward automatically.

remember gravity enabled rigid bodies automatically , maybe haven't attached rigidbody main floor play area.

go on tutorial again , follow along steps carefully, checking if rigidbody has been attached plane.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -