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

Fix BVH to world_aabb, and call update #44651

Merged
merged 1 commit into from
Dec 24, 2020

Conversation

lawnjelly
Copy link
Member

@lawnjelly lawnjelly commented Dec 24, 2020

The calls to the BVH need to use the world space AABB, rather than local space for it to work. Also, update was not being called which is required to update the AABB as objects move.

Also adds a no-op check to updates in the BVH (if the AABB hasn't changed, no need to update).

Notes

@lawnjelly
Copy link
Member Author

Yes, can confirm, results are much more sensible now:

N [-8.896008, -8.665053, -7.578704, 9.959669, 7.271134, 3.794497]
	N [-8.896008, -3.944535, -7.578704, -0.522229, 5.220212, 2.376413]
		N [-8.896008, -3.944535, -7.578704, -0.522229, -0.851945, -1.225996]
			L [-8.896008, -1.051946, -1.459186, -8.662817, -0.851945, -1.225996]
			L [-0.755419, -3.944535, -7.578704, -0.522229, -3.744534, -7.345514]
		N [-6.002581, 4.830162, -4.089075, -1.929282, 5.220212, 2.376413]
			L [-6.002581, 4.830162, -4.089075, -5.769391, 5.030162, -3.855885]
			L [-2.162472, 5.020211, 2.143223, -1.929282, 5.220212, 2.376413]
	N [2.961768, -8.665053, -4.940091, 9.959669, 7.271134, 3.794497]
		N [2.961768, -7.519677, 1.149546, 9.959669, 7.271134, 2.276365]
			L [2.961768, -7.519677, 2.043175, 3.194958, -7.319676, 2.276365]
			L [9.726479, 7.071133, 1.149546, 9.959669, 7.271134, 1.382737]
		N [4.359582, -8.665053, -4.940091, 5.016697, -5.694136, 3.794497]
			L [4.359582, -8.665053, 3.561306, 4.592772, -8.465052, 3.794497]
			L [4.783507, -5.894136, -4.940091, 5.016697, -5.694136, -4.706901]

I'll also put a no-op check on the update function.

The calls to the BVH need to use the world space AABB, rather than local space for it to work. Also, update was not being called which is required to update the AABB as objects move.
@lawnjelly lawnjelly changed the title [WIP] Fix BVH to world_aabb, and call update Fix BVH to world_aabb, and call update Dec 24, 2020
@reduz reduz merged commit 4d9b95f into godotengine:master Dec 24, 2020
@lawnjelly lawnjelly deleted the bvh_world_aabb branch December 24, 2020 13:38
@akien-mga akien-mga modified the milestones: 3.4, 4.0 Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants