- Home /
Rectangle handle size
When creating handles with Handles.FreeMoveHandle() and using RectangleHandleCap(), the FreeMoveHandle() is only accepting float value for the handle size. This leads to a problem when I would like to create box handle that is uneven on sides. (width being different than height). Any idea how to create rectangle handle that accepts Vector2 as size?
I'm trying to make handle that is even size as the BoxCollider2D size. Thanks in advance.
Answer by SgtOkiDoki · Mar 24, 2020 at 12:22 PM
You can edit Handles.matrix.
For example =
Handles.matrix = Matrix4x4.TRS(Vector3.zero,Quaternion.identity,new Vector3(width, height, 1f));
Handles.Draw......
While I didn't find a way yet to do it this way with Handles.matrix, it really helped me (even tho the question is old) to rotate handles. Also found work around for original question with is great. Had no idea about these matrix system but after googling a while it seems interesting for fine tuning handles. Thank you.
AND after just writing this I got it. Stupid me, now it also scales as it should. This is the way to do it. Thank you.