This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Make several AnimationPlayer instances work separately

GridGrid Posts: 9Member

Hello. Currently, when I play a single animation in AnimationPlayer, this animation starts playing in other instances.
Can I separate those somehow? Example.

Comments

  • GridGrid Posts: 9Member

    UPD: I replaced animations with shaders for now.
    My plan was to make effects like in this video.
    Right now it feels like a good solution. (Video).

    (Smoothstep example here imitates a line in a video, white noise there makes glow more interesting; I also enabled "glow" filter in camera options.)

    Code for a ShaderMaterial:

    shader_type spatial;
    render_mode cull_disabled;
    
    float rnd (vec2 st) {
        return fract(
            sin(
                dot(st.xy,
                vec2(12.9898,78.233))
            ) * 43758.5453123
        );
    }
    
    void fragment() {
        vec2 ipos = ceil(UV * 40.0);
        float d = 0.0;
        d += smoothstep(
            .05,
            .005,
            abs(sin(TIME)) - UV.y
        );
        d *= rnd(ipos + TIME);
        ALBEDO = vec3(d);
        ALPHA = d;
        EMISSION = vec3(d) * 6.0;
    }
    

    Still, it will be very nice to know how to do animations, which are independent from each other.

  • GridGrid Posts: 9Member

    UPD 2: I finally figured out what was wrong.

    Animations change material parameters, i.e. while animation is played for a single time, it changes each material's parameter. The solution was to duplicate CSGMesh instance material like that:

    extends CSGMesh
    
    func _init():
        var dup_mat = self.material.duplicate()
        self.material = dup_mat
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.