public void CaptureFrame() { if (selectedGameObject != null) { AnimVR.AnimationContainer container = selectedGameObject.GetComponent <AnimVRModule>().m_animation; Transform object_transform = selectedGameObject.GetComponent <Transform>(); // Check if using record mode, if not use manual mode time float currentTime = 0.0f; if (isRecordMode) { currentTime = m_animTimer; } else { currentTime = m_graphEditor.getTime(); } // Add keyframe to animation container container.AddKeyframe(AnimVR.KEYFRAME_TYPE.POS_X, currentTime, object_transform.position.x); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.POS_Y, currentTime, object_transform.position.y); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.POS_Z, currentTime, object_transform.position.z); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.ROT_X, currentTime, object_transform.rotation.x); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.ROT_Y, currentTime, object_transform.rotation.y); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.ROT_Z, currentTime, object_transform.rotation.z); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.SCALE_X, currentTime, object_transform.localScale.x); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.SCALE_Y, currentTime, object_transform.localScale.y); container.AddKeyframe(AnimVR.KEYFRAME_TYPE.SCALE_Z, currentTime, object_transform.localScale.z); // update animation clip and redraw GraphCanvas container.ModifyClip(); m_graphEditor.makeDirty(); } }
private void Awake() { m_animation = new AnimVR.AnimationContainer(); }
public void SetCurrentAnimation(ref AnimVR.AnimationContainer animation) { currentAnimation = animation; m_isDirty = true; }