public PlaneDescriptor(PlaneId planeId, PlaneQuadrantId planeQuadrant) { _id = planeId; _quadrant = planeQuadrant; _firstAxisDescriptor = PlaneIdHelper.GetFirstAxisDescriptor(planeId, planeQuadrant); _secondAxisDescriptor = PlaneIdHelper.GetSecondAxisDescriptor(planeId, planeQuadrant); }
public void MakeSliderPlane(GizmoTransform sliderPlaneTransform, PlaneId planeId, GizmoLineSlider3D firstAxisSlider, GizmoLineSlider3D secondAxisSlider, Camera camera) { PlaneQuadrantId quadrantId = sliderPlaneTransform.Get3DQuadrantFacingCamera(planeId, camera); AlignToQuadrant(sliderPlaneTransform, planeId, quadrantId, true); Vector3 firstQdrAxis = sliderPlaneTransform.GetAxis3D(PlaneIdHelper.GetFirstAxisDescriptor(planeId, quadrantId)); Vector3 secondQdrAxis = sliderPlaneTransform.GetAxis3D(PlaneIdHelper.GetSecondAxisDescriptor(planeId, quadrantId)); Vector3 sliderOffset = firstQdrAxis * secondAxisSlider.GetRealSizeAlongDirection(camera, firstQdrAxis) * 0.5f + secondQdrAxis * firstAxisSlider.GetRealSizeAlongDirection(camera, secondQdrAxis) * 0.5f; if (LookAndFeel.PlaneType == GizmoPlane3DType.Quad) { SetQuadCornerPosition(QuadCorner.BottomLeft, sliderPlaneTransform.Position3D + sliderOffset); } }
public void AlignToQuadrant(GizmoTransform transform, PlaneId planeId, PlaneQuadrantId quadrantId, bool alignXToFirstAxis) { Plane plane = transform.GetPlane3D(planeId, quadrantId); if (alignXToFirstAxis) { AxisDescriptor secondAxisDesc = PlaneIdHelper.GetSecondAxisDescriptor(planeId, quadrantId); Vector3 secondAxis = Gizmo.Transform.GetAxis3D(secondAxisDesc); _transform.Rotation3D = Quaternion.LookRotation(plane.normal, secondAxis); } else { AxisDescriptor firstAxisDesc = PlaneIdHelper.GetFirstAxisDescriptor(planeId, quadrantId); Vector3 firstAxis = Gizmo.Transform.GetAxis3D(firstAxisDesc); _transform.Rotation3D = Quaternion.LookRotation(plane.normal, firstAxis); } }