- Home /
jerks in gameplay of doodlejump like game
hello everyone,I have been working on doodle jump like gameplay ,there are certain glitches popping up because of its jump,changing its layer according to the direction of velocity.Problem arises when it gets downward OR zero velocity inside the brick collider and changes its layer to that of brick. void Update ()
{
if (rigidbody2D.velocity.y < 0)
this.layer = LayerMask.NameToLayer("brick");
else
this.layer = LayerMask.NameToLayer("player"); }
Hi, Unity 5 has some special 2D components to handle one way platforms. Documentation about PlatformEffector2D should help. http://docs.unity3d.com/$$anonymous$$anual/class-PlatformEffector2D.html
Answer by Mortoc · Jun 19, 2015 at 09:38 PM
Move this code from Update to FixedUpdate since it's dealing with physics (the rigidbody).
Didnt work out,the player gets into the brick layer when still inside the collider of the brick(sorry for the use of words in pic)
Check Answers for "one way platforms", there are lots of posts related to this. Also check the PlatformEffector2D as it is present to solve this problem.