So I have a very simple code and I can’t see why some objects flash. I noticed they do that when they collide and rotate. Other than that it seems really random and nothing in the code can explain that. I just have the Physics behavior, that’s all.
If I click “fixed rotation” then they stopped disappearing!
Can you provide a screen snip of the rotating and collision events?
Yes I could do that later. Right now it’s a mess hard to read. But basically I just create some square with the physics behavior. Give them an impulse. And that’s all. So it clearly bugs. I wonder if it’s because I create to many of these squares: one per frame. They’re deleted when out of the screen though.
I notices I have other bugs. Like if i remove the impulse. it’s still applied. crazy
Yes, and it’s most likely in your event logic. If the events are a mess and hard to read, I’d hazard a guess that there’s an issue with it. So, the sooner you can tidy up the events and get a screen snip, the sooner the issue can be resolved.
no, it’s a bug. I remove the effect and it’s still here. There’s no event that makes my sprites disappear. Same with the impulse.
I have advanced in the code so now it’s would be hard to read the original lines. But the bug started when I had very few lines. So i could rewrite them separately.
so here I have wrote a small code that shows the bug. If the “sq” sprites (just white squares that gets random color according to a value) have the physics behavior, dynamic, bullet, can sleep. When fixed rotation is clicked on then the game works fine. When fixed rotation is off, then the game bugs: the squares “sq” disappear randomly.
To play you need to approach one of these sq sprites with the cursor, as it gets bigger more sq are created. If you play a bit with fixed rotation off you will see that they disappear or flash!
edit: i can send the code privately
I think I kind of fixed it. The collision mask was a bit off. I changed the collision mask and they don’t disappear. But I though the collision mask didn’t play a role in the physics behavior because physics behavior uses its own collision mask, right? Might be wrong. if physics behavior did use the collision mask that was set a bit off then I can understand why the squares disappear because they would rotate around an axis(point) way off their center. But that’s still weird because they were rotating around their center and disappearing. I can’t explain.
No, it’s not a bug. It’s your events.
Correct, physics collision uses physics collision masks. The sprite collision mask does not affect this.
No need, I saw what was posted.
Things can go awry with physics if you scale the image using the standard change scale action. Instead, use the Physics shape scale to change the physics collision mask:
yes I was scaling the objects using the standard change scale action, the only one I knew about. So I guess the bug came from that. Call it what you want but if using the normal scale action makes everything goes wrong for me it’s a bug. At least they should put that information somewhere because i read all i could and never read that information. Imagine the number of hours and forum discussions saved if they were putting few hours into a real tutorial…
The sprite object and physics behaviour shouldn’t be viewed as one thing, but rather 2 separate items. The sprite object is the visual representation. The physics component is a non-visual attachment that only cares about the physics body. The physics engine does not concern itself with the visuals.
And this is the right way to approach this situation. Otherwise if the physics engine was replaced, then there would be a lot of undoing, unpicking and rebuilding of connections between the two.
You might be able to update the wiki to include the information.