- Home /
Quaternion.identity giving outlier result?
I have planes attached to various objects that I always want rotated in a certain way (where the plane is locked, not the parent object), so I use the following code:
private var fixedRotate : Quaternion = Quaternion.identity;
function FixedUpdate () { transform.rotation = fixedRotate; }
This works on every object except ones created from a certain prefab (the only significant difference being the model, but the others use a variety of different models with no problems).
Any time I use this with objects from that prefab it will end up with an odd result, leaving the plane attached to it at a skewed angle relative to all the others (except when I have the initial position at 0 or 180 degrees at time of instantiation in which case it also works, but I can't effectively use that as a workaround).
I've been unable to find anything to suggest what the underlying problem might be, and all my attempts at a workaround have failed (I even tried grabbing the transform.rotation from a properly oriented plane at runtime with no luck). As far as I can tell, this prefab just renders global coordinates differently than it should for some reason (but that's a total guess). Any ideas on what might be the problem/solution?
Thanks
Answer by Owen-Reynolds · Mar 22, 2013 at 06:18 PM
Script isn't attached? Plane model itself is skewed? plane's parent is spinning? It is working, except your model has flipped normals so it just looks wrong?
One trick is to circle around the problem. Take a prefab that works and switch to the "broken" model. Take the broken prefab and switch to a model that works elsewhere. If the broken prefab has children, "transplant" them to the parent of a working PF, then vice-versa... .
It does indeed look like the model itself has something screwy going on, so hopefully fixing that will fix the problem. Thanks for pointing me in that direction
Your answer
Follow this Question
Related Questions
How to always rotate clockwise 1 Answer
Rotate an object relative to Camera 2 Answers
IMU Sensor and Quaternion 2 Answers
Top down camera for object moving on sphere 1 Answer
How do I rotate Z axis based off mouse click and drag? 2 Answers