Skip to content

Crash if we try to decrease num_segments of the rope at runtime #29

@Corneguidouille

Description

@Corneguidouille

You can reproduce it easily in your demo: rope_pulling.tscn

Add this line:
rope.num_segments = rope.num_segments - 1

In PlayerB gd script:

`@onready var rope: Rope = $"../Rope"

...

func _update() -> void:
...
if Input.is_key_pressed(KEY_RIGHT):
rope.num_segments = rope.num_segments - 1
wishdir.x += 1`

And you will crash here:

func set_point_simulation_weight(index: int, weight: float) -> void:
_simulation_weights[index] = clampf(weight, 0.0, 1.0)

OutOfBound exception because _simulation_weights size is 10 and index is 10

Image

Thanks for your work on this awesome plugin !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions