- Home /
rigidbody2D gravity problem
Hi, I finished my game. while testing noticed a problem. as you can see (image) I have 3 game objects in my scene. they have rigidbody2D. they're falling to the ground normally. but sometimes one of my game objects goes to the (0,0) . gravity doesn't work for that game object. when this happens game doesn't work as i want. anyone has any idea why this happens ? Thank you. here is the code for spawning game objects :
GameObject go1 = Instantiate (myArray [0], new Vector2 (x,y), transform.rotation) as GameObject;
and here is the graphic of my problem :
Answer by MelvMay · Oct 01, 2015 at 07:48 AM
If you're using constraints then it may be a bug that was fixed in 5.1.2 patch 3 and 5.2.0 patch 1 where the rigid-body position would occasionally be moved to the world origin.
Thanks a lot. Using constraints for my game objects . That must be the reason. thanks again.
Answer by GiyomuGames · Oct 01, 2015 at 07:52 AM
Are you sure there is no script setting the GO3 transform position to (0, 0)?
Your answer
![](https://koobas.hobune.stream/wayback/20220612035631im_/https://answers.unity.com/themes/thub/images/avi.jpg)