unity3d - Separate RigidBod2D rotation from Sprite -


using unity 2d allow use rigidbody2d, want prevent sprite rotating when rigidbody rotates. how can this?

in other words, want simulation fine, not want graphics object rotate.

use 2 gameobjects: parent gameobject containing rigidbody2d component, , child gameobject containing spriterenderer component.

then attach script child gameobject assigns transform.rotation whatever you'd like:

var desiredrotation:quaternion;  function lateupdate () {     transform.rotation = desiredrotation; } 

this allows sprite maintain rotation continously, no matter how rigidbody rotated.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -