Exemplo n.º 1
0
    // physics update
    unsafe void FixedUpdate()
    {
        // sync if too late
        float time;

        MJP.GetTime(&time);
        if (time + 0.2 < Time.time)
        {
            MJP.SetTime(Time.time);
            videotime = Time.time;
        }

        // simulate
        int reset;

        MJP.Simulate(Time.time, (pause ? 1 : 0), &reset);

        // sync if internal reset
        if (reset > 0)
        {
            MJP.SetTime(Time.time);
            videotime = Time.time;
        }

        // save video frames at 60Hz
        if (record && Time.time - videotime > 1.0f / 60.0f)
        {
            RenderToTexture();
            videofile.Write(offtex.GetRawTextureData(), 0, 3 * offwidth * offheight);
            videotime = Time.time;
        }
    }
Exemplo n.º 2
0
    // physics update
    unsafe void FixedUpdate()
    {
        // sync if too late
        float time;

        MJP.GetTime(&time);
        if (time + 0.2 < Time.time)
        {
            MJP.SetTime(Time.time);
            videotime = Time.time;
        }

        // simulate
        int reset;

        MJP.Simulate(Time.time, (pause ? 1 : 0), &reset);

        // sync if internal reset
        if (reset > 0)
        {
            MJP.SetTime(Time.time);
            videotime = Time.time;
        }

        // save video frames at 60Hz
        if (record && Time.time - videotime > 1.0f / 60.0f)
        {
            videofile.Write(off_render.RenderColor(thecamera).GetRawTextureData(), 0, off_render.GetColorBufferSize());
            videotime = Time.time;
        }
    }