SOLVED Physics fixture "library" problem?

CruelBus

Member
A little reassurance or correction is requested:

In my physics based game, some objects need to drop their fixtures and rebind new ones based on their rotation. To avoid having to go through the whole physics_fixture_create process each time, I have made a fixture "library" of sorts which just hangs out in the room and holds fixture definitions.

As an example, inside the create event of
FIXTG1:
Code:
PF_FALL=physics_fixture_create();//5x5 fall sensor
    physics_fixture_set_box_shape(PF_FALL,2.5,2.5);//can be modified in instances
    physics_fixture_set_density(PF_FALL,.01);
    physics_fixture_set_collision_group(PF_FALL,0); 
    physics_fixture_set_sensor(PF_FALL,true);
    physics_fixture_set_awake(PF_FALL,true);
When certain obects are created, they may perform the following:
Code:
FIXbound=physics_fixture_bind(FIXTG1.PF_FALL,id);
In my mind, all this is doing is taking that single definition of the fixture and binding it to itself.

Is it actually calling the creation of a new fixture each time that may cause a memory leak?

In the profiler, memory stays constant over 30 minutes, so I'm thinking there isn't a leak, but recently, I have been getting a black-screen crash to the home window on Android when stress testing (4x the normal amount of physics objects) with no information about what caused it.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
What you are doing is fine, and is EXACTLY how the fixture functions should be used. Just make sure to call physics_fixture_delete() on the library fixtures when you don't need them (unless they are global, or stored from game start to game end, in which case you're fine).

I have been getting a black-screen crash to the home window on Android when stress testing (4x the normal amount of physics objects) with no information about what caused it.
I don't think the crash is related to this system, tbh...
 
Top