Animated TEXT_DRAW_FONT_MODEL_PREVIEW
#1

Yeah, I know that it's cool new stuff, but I was wondering if there is a way to animate the object/vehicle. There is function TextDrawSetPreviewRot, but to see its effect I have to hide and then show again the textdraw. There is lag between this, so I've decided to create another textdraw which will fill the time gaps. This works, but if the animation speed is too high, then CPU goes crazy

pawn Код:
static Text:txt[2];
static tmp = 0;
forward Shadow();
forward Rotate();
forward Ghost();

#define TIME        (1000)

public OnFilterScriptInit() {
    Build(txt[0]);
    TextDrawHideForAll(txt[0]);
    Build(txt[1]);
   
    SetTimer("Shadow", TIME - 60, 1);
    return 1;
}
public Shadow() {
    TextDrawShowForAll(txt[1]);
    SetTimer("Rotate", 60, 0);
}

public Rotate() {
    tmp += 1;
    tmp %= 360;
    SetTimer("Ghost", 50, 0);
    TextDrawHideForAll(txt[0]);
    TextDrawSetPreviewRot(txt[0], -20.0, 0.0, float(tmp), 1.0);
    TextDrawShowForAll(txt[0]);
    return 1;
}

public Ghost() {
    TextDrawHideForAll(txt[1]);
    TextDrawSetPreviewRot(txt[1], -20.0, 0.0, float(tmp), 1.0);
    return 1;
}

stock Build(&Text:who) {   
    who = TextDrawCreate(320.0, 240.0, "_");
    TextDrawFont(who, TEXT_DRAW_FONT_MODEL_PREVIEW);
    TextDrawBackgroundColor(who, 0x00000000);
    TextDrawBoxColor(who, 0xFFFFFFFF);
    TextDrawTextSize(who, 100.0, 100.0);
    TextDrawSetPreviewVehCol(who, 0, 0);
    TextDrawSetPreviewModel(who, 411);
    TextDrawSetPreviewRot(who, -20.0, 0.0, float(tmp), 1.0);
    return 1;
}

public OnFilterScriptExit() {
    TextDrawDestroy(txt[0]);
    TextDrawDestroy(txt[1]);
    return 1;
}
I just want to rotate the model (but quite often). How can I achieve it?
Reply
#2

The problem is that every time you show a model to a player, it's delayed for a fraction of a second while it renders/loads/whatever. No way around this. ****** once suggested creating the next one UNDER the current one (create it before) and then hide the old one after so many miliseconds, that should eliminate the lag.
Reply
#3

This current code does this (hiding copy underneath) - well, fluid animation with reasonable speed is out of option due to poor performance. (and I'll never stop wondering why authors of samp represented models as a font - webdings much?)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)