// Start is called before the first frame update void Start() { motionSetup = gameObject.GetComponent <MotionSetup>(); motionSetup.instantTime = MathsFunctions.linspace(0, Settings.duration - (Settings.duration / (Settings.duration * Settings.FPS)), (int)(Settings.duration * Settings.FPS)); for (int i = 0; i < (int)(Settings.duration * Settings.FPS); i++) { if (oscillationInXAxis == true) { motionSetup.instantX[i] = (Mathf.Sin(motionSetup.instantTime[i] * Mathf.Abs(speed)) * Mathf.Abs(xDisplacement)) + centrePoint.x; } if (oscillationInYAxis == true) { motionSetup.instantY[i] = (Mathf.Sin(motionSetup.instantTime[i] * Mathf.Abs(speed)) * Mathf.Abs(yDisplacement)) + centrePoint.y; } if (oscillationInZAxis == true) { motionSetup.instantZ[i] = (Mathf.Sin(motionSetup.instantTime[i] * Mathf.Abs(speed)) * Mathf.Abs(zDisplacement)) + centrePoint.z; } if (oscillationInXAxis == false) { motionSetup.instantX[i] = 0 + centrePoint.x; } if (oscillationInYAxis == false) { motionSetup.instantY[i] = 0 + centrePoint.y; } if (oscillationInZAxis == false) { motionSetup.instantZ[i] = 0 + centrePoint.z; } } }
// Start is called before the first frame update void Start() { motionSetup = gameObject.GetComponent <MotionSetup>(); motionSetup.instantTime = MathsFunctions.linspace(0, Settings.duration - (Settings.duration / (Settings.duration * Settings.FPS)), (int)(Settings.duration * Settings.FPS)); for (int i = 0; i < (int)(Settings.duration * Settings.FPS); i++) { float theta = Mathf.PI / 180 * (((endEl - startEl) / motionSetup.instantTime[motionSetup.instantTime.Length - 1] * motionSetup.instantTime[i]) + startEl); float phi = Mathf.PI / 180 * (((endAz - startAz) / motionSetup.instantTime[motionSetup.instantTime.Length - 1] * motionSetup.instantTime[i]) + startAz); if (movementIsClockwise == false) { motionSetup.instantX[i] = (Mathf.Sin(theta) * Mathf.Cos(phi) * radiusMultiplier) + centrePoint.x; motionSetup.instantY[i] = (Mathf.Cos(theta) * Mathf.Abs(height)) + centrePoint.y; motionSetup.instantZ[i] = (Mathf.Sin(theta) * Mathf.Sin(phi) * radiusMultiplier) + centrePoint.z; } else { motionSetup.instantX[i] = -(Mathf.Sin(theta) * Mathf.Cos(phi) * radiusMultiplier) + centrePoint.x; motionSetup.instantY[i] = (Mathf.Cos(theta) * Mathf.Abs(height)) + centrePoint.y; motionSetup.instantZ[i] = (Mathf.Sin(theta) * Mathf.Sin(phi) * radiusMultiplier) + centrePoint.z; } } }
// Start is called before the first frame update void Start() { motionSetup = gameObject.GetComponent <MotionSetup>(); motionSetup.instantTime = MathsFunctions.linspace(0, Settings.duration - (Settings.duration / (Settings.duration * Settings.FPS)), (int)(Settings.duration * Settings.FPS)); motionSetup.instantX = MathsFunctions.linspace(startCoordinates.x, endCoordinates.x, motionSetup.instantTime.Length); motionSetup.instantY = MathsFunctions.linspace(startCoordinates.y, endCoordinates.y, motionSetup.instantTime.Length); motionSetup.instantZ = MathsFunctions.linspace(startCoordinates.z, endCoordinates.z, motionSetup.instantTime.Length); }
// Start is called before the first frame update void Start() { motionSetup = gameObject.GetComponent <MotionSetup>(); motionSetup.instantTime = MathsFunctions.linspace(0, Settings.duration - (Settings.duration / (Settings.duration * Settings.FPS)), (int)(Settings.duration * Settings.FPS)); for (int i = 0; i < (int)(Settings.duration * Settings.FPS); i++) { motionSetup.instantX[i] = transform.position.x; motionSetup.instantY[i] = transform.position.y; motionSetup.instantZ[i] = transform.position.z; } }
// Start is called before the first frame update void Start() { motionSetup = gameObject.GetComponent <MotionSetup>(); motionSetup.instantTime = MathsFunctions.linspace(0, Settings.duration - (Settings.duration / (Settings.duration * Settings.FPS)), (int)(Settings.duration * Settings.FPS)); motionSetup.instantY = MathsFunctions.linspace(-height / 2, height / 2, (int)(Settings.duration * Settings.FPS)); for (int i = 0; i < (int)(Settings.duration * Settings.FPS); i++) { if (movementIsClockwise == false) { motionSetup.instantX[i] = (Mathf.Cos(motionSetup.instantTime[i] * Mathf.Abs(radialSpeed)) * Mathf.Abs(width) * radiusMultiplier) + centrePoint.x; motionSetup.instantY[i] = motionSetup.instantY[i] + centrePoint.y; motionSetup.instantZ[i] = (Mathf.Sin(motionSetup.instantTime[i] * Mathf.Abs(radialSpeed)) * Mathf.Abs(depth) * radiusMultiplier) + centrePoint.z; } else { motionSetup.instantX[i] = -(Mathf.Cos(motionSetup.instantTime[i] * Mathf.Abs(radialSpeed)) * Mathf.Abs(width) * radiusMultiplier) + centrePoint.x; motionSetup.instantY[i] = motionSetup.instantY[i] + centrePoint.y; motionSetup.instantZ[i] = (Mathf.Sin(motionSetup.instantTime[i] * Mathf.Abs(radialSpeed)) * Mathf.Abs(depth) * radiusMultiplier) + centrePoint.z; } } }