示例#1
0
    // Update is called once per frame
    void Update()
    {
        HeartBeat.BeatSize beatSize      = heartbeatSource.PastBeat;
        Vector3            localPosition = transform.localPosition;
        float targetY = beatSize.MechanicalPulse * shakeScale;

        localPosition.y         = Mathf.SmoothDamp(localPosition.y, targetY, ref nodeVelocity, Time.deltaTime);
        transform.localPosition = localPosition;
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        Vector3 localPosition = transform.localPosition;

        HeartBeat.BeatSize beatSize = heartbeat.GetBeatAtTime(Time.time);
        localPosition.y = beatSize.ElectricalPulse;
        //localPosition.y = Mathf.Sin(Time.time);
        //localPosition.x = Time.time;
        transform.localPosition = localPosition;
    }
示例#3
0
    void FixedUpdate()
    {
        HeartBeat.BeatSize beatSize = heartbeat.PastBeat;
        if (beatSize == null)
        {
            beatSize = HeartBeat.ZERO_BEAT_SIZE;
        }
        float pulse = beatSize.PushFactor;

        Vector3 localUp   = referenceTransform.TransformDirection(Vector3.up);
        Vector3 localDown = referenceTransform.TransformDirection(Vector3.down);

        if (Physics.Raycast(targetBody.position, localDown, (float)(sphereRadius + 0.1 * sphereRadius)) && pulse > 0)
        {
            if (lastUpdateTime + noUpdateWindow >= Time.time)
            {
                return;
            }
            lastUpdateTime = Time.time;
            targetBody.AddForce(localUp * pulse * forceScale);
        }
    }