Search Unity

  1. We are looking for feedback on the experimental Unity Safe Mode which is aiming to help you resolve compilation errors faster during project startup.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

BUG? Player colliding when should not

Discussion in 'Project Tiny' started by developer_plus_bliss, Apr 8, 2019.

  1. developer_plus_bliss

    developer_plus_bliss

    Joined:
    Jan 10, 2017
    Posts:
    7
    my player is walking over a collider, but when that ends, the player don't fall, just still going straight like if it was over a collider, but if I press to jump it falls down. How can I fix it?

    The player has a rigidbody.

    jump code:
    Code (CSharp):
    1. if (ut.Runtime.Input.getMouseButtonDown(0)) {
    2.                                     this.playClip("jumpAudio");
    3.                                     const physicsConfig = this.world.getConfigData(ut.Physics2D.Physics2DConfig);
    4.                                     physicsConfig.gravity = new Vector2(0, -30);
    5.                                     this.world.setConfigData(physicsConfig);
    6.                                     let vel = new ut.Physics2D.SetVelocity2D;
    7.                                     vel.velocity = new Vector2(0,0);
    8.                                     let impulse = new ut.Physics2D.AddImpulse2D;
    9.                                     impulse.impulse = new Vector2(0, player.jumpForce);
    10.                                     this.world.addComponentData(entity, vel);
    11.                                     this.world.addComponentData(entity, impulse);
    12.                                 }
     
  2. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    189
    It might be because your changing the pivot of your collider.

    Iv noticed you have to move the collider around with the transform and leave its pivot at (0.5, 0.5)
     
unityunity