unity3d - Allow a rigid body to only move in the Y direction. -


i making 2d game using unity 4.3. have rigidbody2d object. when other physics2d objects hit rigidbody2d object moves little bit in x direction.

i don't want move in x direction. want make rigidbody2d object's x direction fixed. how can achieve that?

unfortunately, rigidbody2d missing key feature present in rigidbody (3d), constraints.

a workaround lock rigidbody2d's position on x-axis, although, may lead bugs in physics:

void update()  {     transform.position = new vector3(static_x, transform.position.y, transform.position.x); } 

another option, not use rigidbody, , attempt simulate physics yourself.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -