public void Draw(Color color) { _circle1.Draw(color, false, ""); _circle2.Draw(color, false, ""); Vector3 rightDirection = SceneView.lastActiveSceneView.camera.gameObject.transform.right; //right of the camera scene view Vector3 forwardDirection = SceneView.lastActiveSceneView.camera.gameObject.transform.forward; Vector3 upDirection = SceneView.lastActiveSceneView.camera.gameObject.transform.up; Vector3 upCylinder = _cylinderMatrix.UpNormalized(); float limit = 0.5f; float dotRight = Vector3.Dot(rightDirection, upCylinder); if (dotRight > limit || dotRight < -limit) { DrawDirectionnalCylinder(color, upCylinder, upDirection); } float dotUp = Vector3.Dot(upDirection, upCylinder); if (dotUp > limit || dotUp < -limit) { DrawDirectionnalCylinder(color, upCylinder, rightDirection); } float dotForward = Vector3.Dot(forwardDirection, upCylinder); if (dotForward > limit || dotForward < -limit) { DrawDirectionnalCylinder(color, upCylinder, rightDirection); DrawDirectionnalCylinder(color, upCylinder, upDirection); } }
public void DrawWithExtraSize(Color color, Vector3 extraSize) { if (extraSize.Maximum() <= 1f) { return; } Matrix4x4 cylinderMatrix = Matrix4x4.TRS(_position, _rotation, (_localScale + extraSize) * _radius); float realRadius = _radius * MaxXY(_localScale + extraSize); ExtCircle circle = new ExtCircle(_position, -cylinderMatrix.UpFast(), realRadius); circle.Draw(color, true, ""); }
public void Draw(Color color) { _circle.Draw(color, true, ""); }