- Home /
Handles.FreeMoveHandle + multiple points selection
Hi
Is it possible to make multiselection of points in editor window?
I have a shape from 10 vertices, and I would like to select 5 and move them.
I have found nice example of editable star but I can't swith from single to multipoint edit mode.
Any hints how it could be done?
void OnSceneGUI () {
Star star = (Star)target;
Transform starTransform = star.transform;
Undo.SetSnapshotTarget(star, "Move Star Point");
float angle = -360f / (star.frequency * star.points.Length);
for(int i = 0; i < star.points.Length; i++){
Quaternion rotation = Quaternion.Euler(0f, 0f, angle * i);
Vector3
oldPoint = starTransform.TransformPoint(rotation * star.points[i].offset),
newPoint = Handles.FreeMoveHandle(oldPoint, Quaternion.identity, 0.04f, pointSnap, Handles.DotCap);
if(oldPoint != newPoint){
star.points[i].offset = Quaternion.Inverse(rotation) * starTransform.InverseTransformPoint(newPoint);
star.UpdateStar();
}
}
}
Comment