- Home /
Strange rotation caused by translation?
Here is the illustration of my problem:
I move player (red rectangle) towards some obstacle (player and obstacle have box colliders)and the player hits that obstacle. Then if I continue pressing the movement key and try to continue moving, then player starts to rotate around obstacle. How can I disable this rotation (I can't use Freeze rotation in Rigidbody because my layer is able to rotate, I just don't want this rotation around obstacles to happen)
Thank's in advance
Not entirely sure what you're trying to accomplish here. Do you simply want your object to get stuck in at the wall or to pass through it without rotating?
If you're using rigidbodies and you have a collision like this, this would be the expected behavior.
Hmm... This isnt strange, if you did that in real life it would happen too. I guess you could have OnColliderStay function or something and 'remember' the old rotation?
Answer by Xtro · Aug 12, 2013 at 02:13 PM
in CollisionEnter do Freeze rotation = true
in CollisionExit do Freeze rotation = false
Well I make 2D game, and I want my character to move only up, down, left and right. I want to limit my character to have rotation of 0, 90, 180, 270 angles. When I hit the obstacle angle changes and I don't want angle of rotation to be 49 or 164 degrees for an example....
I will try CollisionEnter and CollisionStay later, I hope I will make it...
EDIT: Problem Fixed with Freeze Rotation :) Thank you all...
Your answer
Follow this Question
Related Questions
Unwanted rotation 0 Answers
How to make the collision force to effect on one object? 1 Answer
Adjust movement while rotating rigidbody 1 Answer
Weird issue with fire angle of projectiles changing 1 Answer
Player rotating after wall collision 1 Answer