- Home /
My Box collider 2D does not follow the sprite when its jumping.
So I'm trying to make my quad jump on Y-Axis however when doing so the boxcollider2d takes time to catch up with the sprite which is causing it have inaccurate collisions with the obstacles.
Hello.
Please provide code, and this image does not help at all.. what we suposed to see here?
Post 3-4 images to see how it happens, post a video, post image of inspector, image of icheracy... INFO !
Answer by manikiran22 · May 23, 2019 at 04:36 AM
sorry for the inconvenience guyz @tormentoarmagedoom , @xxmariofer was in a hurry. Attaching the code and a video of the behavior. So what i did was make all the jumping possible through raycasts and some box colliders.
Adding vertical collision code only since it's not taking more than 1 snippet.
Video Link: https://imgur.com/a/dodP9ww alt text
Answer by Dalsia · May 23, 2019 at 05:12 AM
I had a similar issue a few months ago. The issue has to do with one of Unity's settings. You need to go to Edit --> Project Settings --> Physics2D and check the box that says "Auto Sync Transforms."
Edit: I see you're a man of culture as well and are making your own raycast system; here's my post in case you're interested: https://answers.unity.com/questions/1593308/2d-why-arent-my-raycasts-conforming-their-origin-p.html
Edit 2: This other post may also be useful for you. I discovered that adding a kinematic Rigidbody2D fixed the discrepancy between my Quad's position and its box collider 2D. https://answers.unity.com/questions/1575939/why-is-my-quad-not-moving-in-sync-with-its-collide.html
Your answer
Follow this Question
Related Questions
Push only 1 box around at a time (2D) 1 Answer
Why is my quad not moving in sync with its collider? 1 Answer
Sprite collision with Tilemap 2 Answers
How to update the Box Collider 2D based on Sprite Size? 0 Answers
Does PolygonCollider2D.OverlapPoint() perform differently in Unity player than an Android device? 1 Answer