-
-
Notifications
You must be signed in to change notification settings - Fork 899
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
Invisible Rigid Body #3213
Comments
2024-07-02.08.27.49.mov |
To confirm your doubt about invisible bodies just check the count of |
Thank you very much! |
The Will it be possible for you to create a simple reproducible example for this? Also, for the expanding behavior, maybe you can create multiple fixtures with varying scale and keep only 1 of them as non-sensor. Then instead of creating and destroying the bodies, you can just change the |
Thank you very much, it helps me a lot. |
Hello, I am trying to implement it by controlling the isSensor flag, and I encountered a problem. The fixture I obtained through body.fixtures cannot modify isSensor, and _isSensor is a private variable. Is my usage wrong? |
Use |
It works fine. Thanks very much |
When I used isSensor to mark and realized the function of making the sphere bigger, invisible bodies no longer appeared on the simulator, but occasionally appeared on Apple's real machine. So I used world.destroyBody while using isSensor to completely avoid this problem.
|
I think you left out the most important part of the problem in your original question. You never mentioned how exactly you were adding and removing the components. I'm pretty sure that the problem is caused by the use of |
I haven't looked closely at what you're doing but |
I tried using a Timer, but the problem persisted.
|
SpawnComponent generates a PositionComponent, but I need to generate a BodyComponent, which seems to be unusable. |
By Timer I meant the Flame's Timer |
It is indeed as you said. After changing to flame timer, this problem no longer occurs.
It is just that when my limit time setting is reduced, the following error will be reported.
|
0.01s is way too small of an interval. For a game running at 60 FPS, 1 frame will take ~0.016 seconds on an average. If you are trying to add and remove something at a higher frequency than that, it won't be even visible. Also, add and remove don't happen instantly. It will take at least 1 frame for those operations to get processed. So if your code is trying change the state faster than what the game is capable of, it will cause such issues. |
You are awesome and totally answered all my questions! |
I debugged again today for some reasons. |
Just to add to that, the 16 ms number was used just as an example. It is not necessary that all flame games will always be running at 60 FPS. It all depends on the hardware and the game itself. Also, it is an average FPS. So it is quite possible that some frames take more than 16 ms and some take less. Interval values closer to the average frame times will always run the risk of facing this problem. |
What happened?
As you can see in the video, in my current business, I need to achieve the effect of a polygonal rigid body becoming larger. I achieve this by creating and removing rigid bodies multiple times. When I frequently create rigid bodies and quickly remove them, some invisible rigid bodies will be generated. This phenomenon is sporadic but very frequent, and it is more likely to occur when multiple rigid bodies are simultaneously enlarged.
From the log, the total number of rigid bodies and the total number displayed on the screen are consistent. I am confused about where these invisible rigid bodies come from.
I think these invisible ones may not be rigid bodies, because I have turned on the debug mode. If they are rigid bodies, they should be displayed on the screen. I really can't find a reason that can explain it. Do you have any ideas to provide?
What do you expect?
No more invisible rigid bodies are generated
How can we reproduce this?
No response
What steps should take to fix this?
No response
Do have an example of where the bug occurs?
No response
Relevant log output
No response
Execute in a terminal and put output into the code block below
Affected platforms
Android
Other information
Are you interested in working on a PR for this?
The text was updated successfully, but these errors were encountered: