private void GetManipulatorProperty(ManipulatorObjectC manipulator) { m_ManipulatorObject = manipulator; // Handles work in world space, so we need to convert position and rotation to world space m_Transform = m_ManipulatorObject.transform; m_Position = m_ManipulatorObject.transform.position; m_Rotation = m_ManipulatorObject.transform.rotation = Tools.pivotRotation == PivotRotation.Local ? m_ManipulatorObject.transform.rotation : Quaternion.identity; m_Scale = m_ManipulatorObject.transform.lossyScale; m_Type = m_ManipulatorObject.type; m_Shape = m_ManipulatorObject.shape; m_Size = m_ManipulatorObject.size; m_Bounds = m_ManipulatorObject.bounds; m_Strength = m_ManipulatorObject.strength; m_SmoothStrength = m_ManipulatorObject.smoothStrength; m_SmoothDistance = m_ManipulatorObject.smoothDistance; }
//public int manipulatorInstance = ParticleToolC.manipulatorInstance; public string DebugManipulatorObject(ManipulatorObjectC manipulatorObject) { Transform _transform = manipulatorObject.transform; MANIPULATORTYPE _type = manipulatorObject.type; MANIPULATORSHAPE _shape = manipulatorObject.shape; float _size = manipulatorObject.size; Bounds _bounds = manipulatorObject.bounds; float _strength = manipulatorObject.strength; float _smoothStrength = manipulatorObject.smoothStrength; float _smoothDistance = manipulatorObject.smoothDistance; string manipulatorInfo = ("Manipulator: " + manipulatorObject.transform + "\n" + "Position: " + manipulatorObject.transform.localPosition + "\n" + "Rotation: " + manipulatorObject.transform.localRotation + "\n" + "Type: " + manipulatorObject.type + "\n" + "Size: " + manipulatorObject.size + "\n" + "Strength: " + manipulatorObject.strength + "\n"); return(manipulatorInfo); }
public bool IsParticleInRange(ParticleSystem.Particle particle, Transform transform, MANIPULATORSHAPE shape) { switch (shape) { case MANIPULATORSHAPE.Sphere: float distanceSqr = Vector3.SqrMagnitude(transform.position - particle.position); if (distanceSqr <= size * size) { return(true); } break; case MANIPULATORSHAPE.Box: if (bounds.Contains(particle.position - transform.position)) { return(true); } break; } return(false); }
private void ShowManipulatorStrength(Vector3 position, Quaternion rotation, float strength, float size, MANIPULATORSHAPE shape) { Handles.color = new Color(0, 0.75f, 1, 0.05f);; switch (m_ManipulatorObject.type) { case MANIPULATORTYPE.Attraction: if (shape == MANIPULATORSHAPE.Sphere) { Handles.SphereCap(0, position, rotation, strength * size); } if (shape == MANIPULATORSHAPE.Box) { Handles.CubeCap(0, position, rotation, (strength * size) * 0.5f); } break; case MANIPULATORTYPE.Repellent: if (shape == MANIPULATORSHAPE.Sphere) { Handles.SphereCap(0, position, rotation, (size * 2) + (strength * size) * 0.5f); } if (shape == MANIPULATORSHAPE.Box) { Handles.CubeCap(0, position, rotation, size + (strength * size) * 0.5f); } break; case MANIPULATORTYPE.VortexAttraction: if (shape == MANIPULATORSHAPE.Sphere) { Handles.SphereCap(0, position, rotation, strength * size); } if (shape == MANIPULATORSHAPE.Box) { Handles.CubeCap(0, position, rotation, (strength * size) * 0.5f); } Handles.color = new Color(0, 0.75f, 1, 1.0f); if (shape == MANIPULATORSHAPE.Box) { Handles.DrawLine(position, (position + (m_ManipulatorObject.transform.forward * size) * 0.75f)); } else { Handles.DrawLine(position, (position + (m_ManipulatorObject.transform.forward * size) * 1.25f)); // Quaternion.Euler(Vector3.up) } break; } }
private void ShowManipulatorShape(Vector3 position, Quaternion rotation, float size, MANIPULATORSHAPE shape) { Color handleColor = Color.white; Handles.color = handleColor; switch (shape) { case MANIPULATORSHAPE.Sphere: DrawSphere(position, rotation, size); break; case MANIPULATORSHAPE.Box: DrawCubeHandle(position, size); break; } }