As I can do an animation?

  • Hello gentlemen.


    I'm doing a gallows for bales, and I'm stuck in an animation.


    I have already made it an animation with toggleAnimatedParts to pick up skewers, but for new animation I cannot use me this script.


    What I want is a cylinder to move side to side, by pressing a button, but I don't want that the movement is complete. If you stop pressing the button, the cylinder must stop.


    I've been trying to do it all week, descargandome mods that have similar movements, and I am not able to do it, it always gives me error.


    Also I have seen several posts from this forum, but without good results.


    You have some photos of the mod, so you do an idea.


    [expander] [/expander]




    If someone can tell me how it is done, or tell me of any tutorial to explain it well, is it really appreciate.

  • There are several ways to do this.


    The easiest one is the following i think.



    Use the standard "AnimatedVehicle"-Specialization and create an animation in your vehicle XML.


    XML
    <animations>
    <animation name="YOUR_ANIM_NAME" ... ... ../>
    </animations>


    Then you can handle it in your lua like this.



    [lua]function ClassName:update(dt)
    if self:getIsActiveForInput() then
    if InputBinding.isPressed(InputBinding.YOUR_BINDING) then
    self:playAnimation("YOUR_ANIM_NAME", 1, nil);
    else
    self:stopAnimation("YOUR_ANIM_NAME");
    end;
    end;
    end;
    [/lua]
    I did this in a similar situation.


    Greets

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!