void CheckForTriggerRelease(Standard standardInput, ConsumeControlDelegate consumeControl) { // Ready for next object to be created if (standardInput.action.wasJustReleased) { m_State = PrimitiveCreationStates.StartPoint; consumeControl(standardInput.action); } }
void CheckForTriggerRelease(Standard standardInput, ConsumeControlDelegate consumeControl) { // Ready for next object to be created if (standardInput.action.wasJustReleased) { m_State = PrimitiveCreationStates.StartPoint; #if UNITY_EDITOR UnityEditor.Undo.IncrementCurrentGroup(); #endif consumeControl(standardInput.action); } }
void HandleStartPoint(Standard standardInput, Action <InputControl> consumeControl) { if (standardInput.action.wasJustPressed) { m_CurrentGameObject = GameObject.CreatePrimitive(m_SelectedPrimitiveType); // Set starting minimum scale (don't allow zero scale object to be created) const float kMinScale = 0.0025f; m_CurrentGameObject.transform.localScale = Vector3.one * kMinScale; m_StartPoint = rayOrigin.position + rayOrigin.forward * kDrawDistance; m_CurrentGameObject.transform.position = m_StartPoint; m_State = m_Freeform ? PrimitiveCreationStates.Freeform : PrimitiveCreationStates.EndPoint; addToSpatialHash(m_CurrentGameObject); consumeControl(standardInput.action); Selection.activeGameObject = m_CurrentGameObject; } }
void HandleStartPoint(Standard standardInput, ConsumeControlDelegate consumeControl) { if (standardInput.action.wasJustPressed) { m_CurrentGameObject = GameObject.CreatePrimitive(m_SelectedPrimitiveType); Undo.RegisterCreatedObjectUndo(m_CurrentGameObject, "Create Primitive"); // Set starting minimum scale (don't allow zero scale object to be created) const float kMinScale = 0.0025f; var viewerScale = this.GetViewerScale(); m_CurrentGameObject.transform.localScale = Vector3.one * kMinScale * viewerScale; m_StartPoint = rayOrigin.position + rayOrigin.forward * k_DrawDistance * viewerScale; m_CurrentGameObject.transform.position = m_StartPoint; m_State = m_Freeform ? PrimitiveCreationStates.Freeform : PrimitiveCreationStates.EndPoint; this.AddToSpatialHash(m_CurrentGameObject); consumeControl(standardInput.action); Selection.activeGameObject = m_CurrentGameObject; } }