0 votes


I'm using the Navmesh Demo as a template to create 3D lines. The code below generates 3D lines at random locations.

Problem: using the clear() method for the GeometryInstance node (renamed 'draw' here) does not clear the vertex buffer of the node. I know this because running the scene creates an increasing amount of randomly positioned lines.

How can I clear this buffer without having to assign the pointer to the node as null?

extends Spatial

var im

func _ready():
        var material = SpatialMaterial.new()


        im = get_node("draw")

func _process(delta):
        im.begin(Mesh.PRIMITIVE_LINE_STRIP, null)

           #create 2 points per line
        for n in range(2):
            var point = Vector3(randf()*10-5, randf()*10-5, randf()*10)
in Engine by (92 points)
retagged by

Are you actually talking about ImmediateGeometry? GeometryInstance does not have clear function.

    im.begin(Mesh.PRIMITIVE_LINE_STRIP, null)

Did you try clearing before begin?

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.