Here are the examples of the csharp api UnityEngine.Plane.SetNormalAndPosition(UnityEngine.Vector3, UnityEngine.Vector3) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
View Source File : SliceSegmentTest.cs
License : MIT License
Project Creator : IxxyXR
License : MIT License
Project Creator : IxxyXR
[ContextMenu("Generate")]
public void Generate()
{
var wythoff = new WythoffPoly(PolyType, PrismP, PrismQ);
wythoff.BuildFaces();
poly = new ConwayPoly(wythoff);
if (ApplyOp)
{
var o1 = new OpParams {valueA = op1Amount1, valueB = op1Amount2, facesel = op1Facesel};
poly = poly.ApplyOp(op1, o1);
}
if (Canonicalize)
{
poly = poly.Canonicalize(0.01, 0.01);
}
poly = poly.Transform(Position, Rotation, Scale);
var pos = SlicePosition;
if (animateSlice > 0)
{
pos.y = .1f + transform.position.y + ((Time.time % 2f) * animateSlice);
}
var rot = Quaternion.Euler(SliceRotation) * Vector3.up;
var slicePlane = new Plane(rot, pos);
var result = poly.SliceByPlane(slicePlane, Cap, includeTop, includeBottom);
poly = result.bottom;
var slicePoint = slicePlane.normal * (-slicePlane.distance + SegmentHeight);
slicePlane.SetNormalAndPosition(slicePlane.normal, slicePoint);
var (top, segment, _) = result.top.SliceByPlane(slicePlane, Cap, includeTop, includeBottom);
segment = segment.Transform(SegmentTransform);
poly.Append(top);
poly.Append(segment);
if (Weld)
{
poly = poly.Weld(0.0001f);
}
if (ApplyOp)
{
var o2 = new OpParams {valueA = op2Amount1, valueB = op2Amount2, facesel = op2Facesel};
poly = poly.ApplyOp(op2, o2);
}
var mesh = PolyMeshBuilder.BuildMeshFromConwayPoly(poly, false, null, ColorMethod);
GetComponent<MeshFilter>().mesh = mesh;
}