Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Physics_Body2D.get_collision_exceptions() fails for freed objects #53520

Open
Tracked by #45334
greycheeked opened this issue Oct 7, 2021 · 2 comments
Open
Tracked by #45334

Physics_Body2D.get_collision_exceptions() fails for freed objects #53520

greycheeked opened this issue Oct 7, 2021 · 2 comments

Comments

@greycheeked
Copy link

greycheeked commented Oct 7, 2021

Godot version

3.3.4.stable.official

System information

Windows 10, GLES 3

Issue description

With add_collision_exception_with() you create a list of bodies with which a certain body should not collide.
After deleting one of the bodies in the list with queue_free() and then accessing the list with get_collision_exceptions(), an error occurs.

Steps to reproduce

In _process() simply get_collision_exceptions() is called without processing the return value further.
As soon as you press RETURN, the only body in the list is deleted, and get_collision_exceptions() throws errors.

extends Node2D

onready var rig1 = $RigidBody2D
onready var rig2 = $RigidBody2D2


func _ready():
	rig1.add_collision_exception_with(rig2)


func _process(delta):
	var exceptions = rig1.get_collision_exceptions()


func _input(event):
	if event.is_action_pressed("ui_accept"):
		if is_instance_valid(rig2):
			rig2.queue_free()

Minimal reproduction project

Collision Exception Test.zip

@1419427247
Copy link

This issue has not been fixed since 4.0.3😔

@Zireael07
Copy link
Contributor

4.0.3 has only just been released, how can you expect it to be fixed since then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants