- Home /
Changing collider's center changes the position of the position handle? wtf?!
So I've been messing around with custom editors for colliders trying to control their center by means of a position handle. I commented out my custom editor so now I've fallen back to the default way Unity draws its colliders (box, sphere, etc). But now I'm faced with a very odd behavior... it seems that if I change the center of a collider, the transform position handle changes its position! - Made a video.
I have absolutely no idea why it's happening... I'm pretty sure my custom editor is commented out... Is this the normal behavior? I don't think so...
Any ideas?
Thanks.
Why does weird shit "always" happen to me? :/ All I did in my custom editors is just copy-paste Unity's editor code, and add my position handle bit:
if (Tools.current == Tool.$$anonymous$$ove)
{
var c = target as SphereCollider;
c.center = c.transform.InverseTransformPoint(Handles.PositionHandle(c.bounds.center, Quaternion.identity));
}
Could I have broken something permanently? I tried restarting Unity, no dice.
Tried different scenes/projects, same. Please don't tell me this is the normal behavior. I lost track of what it is normal and what isn't...
does this happen on every mesh (for example every sphere, cube etc.) ? Did you intend this sphere in your script? If yes, post all the necessary parts for this sphere of the script, so i can help you.
Answer by vexe · Aug 17, 2014 at 01:18 AM
OK that was very disturbing. But at least I'm not crazy. The issue was with the pivot mode, I changed it to "Pivot" and everything's working as expected as opposed to F'ed up when it's "Center". Who uses Center mode anyway?!
I am facing a similar issue. Can you please elaborate the solution? $$anonymous$$ore specifically what changes did you make in the code or did you just change the pivot mode in unity interface.
Your answer
Follow this Question
Related Questions
Is it possible to add new tools, like transform/rotate/scale? 2 Answers
How Can I Move an Object in the Editor by MousePosition? 0 Answers
Editor Script Handles.Label problem. Labels don't move with gameobject 1 Answer
Handles.FreeMoveHandle + multiple points selection 0 Answers
Editor Windows : Help required 1 Answer