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

PhysicsTestMotionParameters2D doesn't clear existing RIDs when setting excludes #82042

Closed
gokiburikin opened this issue Sep 21, 2023 · 0 comments · Fixed by #82043
Closed

PhysicsTestMotionParameters2D doesn't clear existing RIDs when setting excludes #82042

gokiburikin opened this issue Sep 21, 2023 · 0 comments · Fixed by #82043

Comments

@gokiburikin
Copy link

Godot version

v4.2.dev5.official [e3e2528]

System information

Windows 10

Issue description

PhysicsTestMotionParameters2D does not clear the excludes when setting the array unlike PhysicsRayQueryParameters2D which does, meaning PhysicsTestMotionParameters2D can't be reused. This is true for exclude_bodies and exclude_objects.

void PhysicsTestMotionParameters2D::set_exclude_bodies(const TypedArray<RID> &p_exclude) {
for (int i = 0; i < p_exclude.size(); i++) {
parameters.exclude_bodies.insert(p_exclude[i]);
}
}

void PhysicsTestMotionParameters2D::set_exclude_objects(const TypedArray<uint64_t> &p_exclude) {
for (int i = 0; i < p_exclude.size(); ++i) {
ObjectID object_id = p_exclude[i];
ERR_CONTINUE(object_id.is_null());
parameters.exclude_objects.insert(object_id);
}
}

void PhysicsRayQueryParameters2D::set_exclude(const TypedArray<RID> &p_exclude) {
parameters.exclude.clear();
for (int i = 0; i < p_exclude.size(); i++) {
parameters.exclude.insert(p_exclude[i]);
}
}

Steps to reproduce

Attempt to set a PhysicsTestMotionParameters2D's exclude_bodies or exclude_objects multiple times. Only new entries are inserted and you can never clear the existing entries.

Minimal reproduction project

N/A

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

Successfully merging a pull request may close this issue.

2 participants