- Home /
How do I make editable nodes?
I want to have movable nodes for my custom 2d colliders. How canI make a system where I can click on a node and drag it to reposition the vertex of the collider in the editor? I'll have to assign it to a value in a List. Is this possible?
Just making sure... So you can't use the default PolygonCollider2D and edit that?
Yeah, my colliders/physics is built on doubles. I'll of course need to convert all the doubles to Vector3's for interaction with Unity but the underlying values that need to be modified are doubles. Plus, I'm building the system on the XZ plane so the XY 2d colliders would just be confusing.
Answer by MaxEden · Feb 11, 2015 at 08:46 AM
Consider class UnityEditor.Handles
I used Handles.PositionHandles in my project. Just reset Y value to zero if you need to.
point = Handles.PositionHandle (point, Quaternion.identity);
point.y = 0;
$$anonymous$$uch appreciated for the answer. I'm still unsure how to implement handles. Is there a certain method or something they have to be used in? All the examples I could find are in js.
well, it can be used inside OnSceneGUI editor method and inside OnDrawGizmos methods, as far I know. Better to look at concrete implementation.
Your answer
Follow this Question
Related Questions
Draggable Nodes in Editor? 1 Answer
see colliders in editor 1 Answer
Scene Box/Rectangle Editor. Does one exist? 0 Answers
Showing Handles in the Game View 1 Answer
How to suppress BoxCollider warning 2 Answers