One frame too late

Posted By: Razoron

One frame too late - 10/08/10 15:01

Hi,
the propeller is attached to an vertex of my plane. But the faster I get, the propeller sprite is more at the wrong place:
Normal:

High speed:

The code:
Code:
action act_plane_proptrail()
{
    var last_speed;
    
    set(me, PASSABLE);
    ent_scale(me, 0.03);
    vec_set(my.pan, vector(0.01, 0.01, 0.01));
    
    while(ent_player[MY_CLIENTID] == NULL)
    {
        wait(1);
    }
    
    you = ent_player[MY_CLIENTID];
    
    while(ent_player[MY_CLIENTID] != NULL)
    {
        vec_for_vertex(my.x, you, 34);
        vec_set(my.pan, vector(you.pan, you.tilt, my.roll));
        
        if(last_speed > 5 && you.speed <= 5)
        {
            reset(me, TRANSLUCENT);
            my.alpha = 100;
            ent_scale(me, 0.03);
            ent_morph(me, "propeller_ruhig.bmp");
        }
        if(you.speed <= 5)
        {
            my.roll += you.speed * plane_propellerRotationScale * time_step;
        }
        else
        {
            if(last_speed <= 5 && you.speed > 5)
            {
                set(me, TRANSLUCENT);
                my.alpha = 100;
                ent_scale(me, 0.055);
                ent_morph(me, "propeller_lauf.tga");
            }
        }
        if(you.speed > 5)
        {
            my.roll += you.speed * 0.01 * plane_propellerRotationScale * time_step;
        }
        
        last_speed = you.speed;
        
        wait(1);
    }
}


How to change that?
Posted By: painkiller

Re: One frame too late - 10/08/10 15:04

put proc_mode=PROC_LATE on the action of your proppeler, so the action will update the position at the end of the frame and not in the middle, and it will be placed at the correct position each frame.
Posted By: Razoron

Re: One frame too late - 10/08/10 20:22

That was already there.

EDIT: Sorry, wrong function, it's working now, thanks!
© 2024 lite-C Forums