public void UpdateRotationPointAtTimestamp( float timestamp, Vector3 newPosition, Action callback) { // Check if timestamp passed as argument matches any in the // rotation path. var foundMatch = RotationPath.NodeAtTimeExists(timestamp); // If timestamp was not found.. if (!foundMatch) { Debug.Log( "You're trying to change rotation for nonexistent " + "node."); return; } RotationPath.MovePointToPosition(timestamp, newPosition); callback(); OnRotationPointPositionChanged(); }
public void OffsetRotationPathNodeTangents( int nodeIndex, Vector3 tangentDelta) { RotationPath.OffsetNodeTangents(nodeIndex, tangentDelta); OnNodeTangentsChanged(); }
public void UpdateRotationPathWithRemovedKeys() { var pathTimestamps = GetPathTimestamps(); // Get values from rotationPath. var rotationCurvesTimestamps = RotationPath.Timestamps; // For each timestamp in rotationPath.. for (var i = 0; i < rotationCurvesTimestamps.Length; i++) { // Check if same timestamp exist in rotationPath. var keyExists = pathTimestamps.Any( nodeTimestamp => Utilities.FloatsEqual( rotationCurvesTimestamps[i], nodeTimestamp, GlobalConstants.FloatPrecision)); // If key exists check next timestamp. if (keyExists) { continue; } // Remove node from rotationPath. RotationPath.RemoveNode(i); break; } }
/// <summary> /// Set rotation path node positions to the same as in anim. object /// path. /// </summary> private void ResetRotationPathValues() { var animPathNodePositions = GetNodePositions(); for (var i = 0; i < animPathNodePositions.Count; i++) { RotationPath.MovePointToPosition(i, animPathNodePositions[i]); } }
private void InitializeRotationPath() { var firstNodePos = new Vector3(0, 0, 0); RotationPath.CreateNewNode(0, firstNodePos); var lastNodePos = new Vector3(1, 0, 1); RotationPath.CreateNewNode(1, lastNodePos); }
/// <summary> /// Create rotation point for given path node. /// </summary> /// <param name="nodeTimestamp"></param> private void CreateRotationPoint(float nodeTimestamp) { // Calculate value for new rotation point. var rotationValue = RotationPath.GetVectorAtTime(nodeTimestamp); // Create new rotation point. RotationPath.CreateNewNode( nodeTimestamp, rotationValue); }
public void OffsetRotationPathPosition(Vector3 moveDelta) { // For each node.. for (var i = 0; i < NodesNo; i++) { var oldPosition = GetRotationPointPosition(i); var newPosition = oldPosition + moveDelta; // Update node positions. RotationPath.MovePointToPosition(i, newPosition); } }
public void UpdateRotationPathWithAddedKeys() { var pathTimestamps = GetPathTimestamps(); // For each timestamp in the path.. foreach (var pathTimestamp in pathTimestamps) { // Check if key at timestamp exists in rotation path. var keyExists = RotationPath.NodeAtTimeExists(pathTimestamp); // If not.. if (!keyExists) { CreateRotationPoint(pathTimestamp); } } }
public void UpdateRotationPathTimestamps( List <float> distributedTimestamps) { RotationPath.ReplaceTimestamps(distributedTimestamps); }
public void SmoothRotationPathNodeTangents(int nodeIndex) { RotationPath.SmoothNodeInOutTangents(nodeIndex, 0); }
public void SmoothAllRotationPathNodes() { RotationPath.SmoothAllNodes(); }
public List <Vector3> SampleRotationPathForPoints( int samplingFrequency) { return(RotationPath.SamplePathForPoints(samplingFrequency)); }
public Vector3 GetRotationPointPosition(int nodeIndex) { return(RotationPath.GetVectorAtKey(nodeIndex)); }
public Vector3 GetRotationAtTime(float timestamp) { return(RotationPath.GetVectorAtTime(timestamp)); }
public AnimationPath() { movementPath = new MovementPath(); rotationPath = new RotationPath(); }