Example #1
0
        IEnumerator RumbleRoutine(AvatarController avatar)
        {
            var rumble = new RumbleInfo {
                lowIntensity  = lowIntensity,
                highIntensity = highIntensity,
            };

            avatar.AddRumble(rumble);
            yield return(Wait.forSeconds[duration]);

            avatar.RemoveRumble(rumble);
        }
Example #2
0
    static Vector3 Rumble(double time, RumbleInfo outer, RumbleInfo inner)
    {
        const double twoPI = Mathf.PI * 2.0;
        double       x, y;

        x = Math.Sin((inner.phase + time) * twoPI * inner.frequency) * inner.amplitude.x;
        x = Math.Cos((x + (outer.phase + time)) * twoPI * outer.frequency) * outer.amplitude.x;

        y = Math.Cos((inner.phase + time) * twoPI * inner.frequency) * inner.amplitude.y;
        y = Math.Sin((y + (outer.phase + time)) * twoPI * outer.frequency) * outer.amplitude.y;

        return(new Vector3((float)x, (float)y, 0f));
    }
Example #3
0
    //Its not really rumble more like sway

    static Vector3 Rumble(double time, RumbleInfo outer, RumbleInfo inner)
    {
        //MATH!!!
        const double twoPI = Mathf.PI * 2.0;
        double       x, y;

        //allow the camera to sway in a sort of circlular motion
        //x = cos(((sin((inner.phase + time) * (pi * 2) * inner.frequency) * inner amplitude.x) + (outer.phase + time)) * (pi * 2) * outer.frequency) * outer.amplitude.x
        //with this we can by each frame, calucalate the x position on a circular path
        x = Math.Sin((inner.phase + time) * twoPI * inner.frequency) * inner.amplitude.x;
        x = Math.Cos((x + (outer.phase + time)) * twoPI * outer.frequency) * outer.amplitude.x;

        y = Math.Cos((inner.phase + time) * twoPI * inner.frequency) * inner.amplitude.y;
        y = Math.Sin((y + (outer.phase + time)) * twoPI * outer.frequency) * outer.amplitude.y;

        return(new Vector3((float)x, (float)y, 0f));
    }