//Sets the collider to be a box shape with the given size and offset in local space public void SetBox(Vector3 offset, Vector3 size) { boxOffset = offset; boxSize = size; boxSidesPos = offset + size * 0.5f; boxSidesNeg = offset - size * 0.5f; if (cornerPositionMode == CornerPositionEditMode.Individual) { cornerPositionMode = CornerPositionEditMode.BoxCenter; } for (int i = 0; i < corners.Length; i++) { corners[i].localPos = Vector3.Scale(corners[i].normalizedCornerLocation, size) * 0.5f + offset; } }
//Copies properties from another GeneratorProps instance //If copyPreset is true, it will also copy the linked preset reference from the other instance public void CopyProperties(GeneratorProps gp, bool copyPreset) { if (copyPreset) { linkedPreset = gp.linkedPreset; } meshAssetPath = gp.meshAssetPath; cornerPositionMode = gp.cornerPositionMode; cornerRadiusMode = gp.cornerRadiusMode; cornerOffsetMode = gp.cornerOffsetMode; cornerDetailMode = gp.cornerDetailMode; boxSize = gp.boxSize; boxOffset = gp.boxOffset; boxSidesPos = gp.boxSidesPos; boxSidesNeg = gp.boxSidesNeg; for (int i = 0; i < corners.Length; i++) { corners[i] = new ColliderCorner(gp.corners[i]); } for (int i = 0; i < cornerDetails.Length; i++) { cornerDetails[i] = gp.cornerDetails[i]; } topSegments = gp.topSegments; bottomSegments = gp.bottomSegments; XYDetail = gp.XYDetail; YZDetail = gp.YZDetail; XZDetail = gp.XZDetail; detailSmoothness = gp.detailSmoothness; stripDistribution1 = gp.stripDistribution1; stripDistribution2 = gp.stripDistribution2; bypassPolyTest = gp.bypassPolyTest; polyTestMode = gp.polyTestMode; detailReduction = gp.detailReduction; detailReductionAttempts = gp.detailReductionAttempts; boxedCorners = gp.boxedCorners; hooks = new DeformHook[gp.hooks.Length]; for (int i = 0; i < hooks.Length; i++) { hooks[i] = new DeformHook(gp.hooks[i]); } }
//Sets the position of a corner with the given location identifier in local space public void SetCornerPosition(ColliderCorner.CornerId corner, Vector3 pos) { GetCornerAtLocation(corner).localPos = pos; cornerPositionMode = CornerPositionEditMode.Individual; }