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 Group createCallback not working as expected, removes hit detection #4657
Comments
The Physics Group uses this callback itself for its own internal requirements, so when you replace it (as per the second example) you override what it needs to do, hence no physics bodies are created. It should be marked as private, but JSDoc is a bit crappy when it comes to overriding docs inherited from parent classes. |
@photonstorm That makes a lot of sense, and like I mentioned it felt very hacky. Is there any way we can get a hook into this for the physics groups, while still allowing it to do its own work internally? |
Override it, like you're doing, but make sure to call |
Yep, that will work thanks. Is there any reason not to implement this directly into the physics group itself? (calling createCallbackHandler + custom hook) |
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
Version
Description
I'm having an issue related to #4420, but with createCallback on Physics group. createCallback is never called within a Physics Group config. If you manually assign the createCallback property after the group has been created, then the physics body becomes invalidated and collision does not work. You have to manually enableBody on the created child to get it to work again.
Example Test Code
CreateCallback is never called within a Physics Group config:
The callback will get called if adding it subsequently as a property:
However, once you add the above callback property, collision detection stops working completely:
Additional Information
This hack (re-enabling child body in callback) works, but feels like working against what it's supposed to do. We're trying to say "all objects in this group have a physics body" so having to enable physics again isn't great. Perhaps I'm doing something wrong from the get-go:
The text was updated successfully, but these errors were encountered: