physX_open() calling again -> physic is not running

Posted By: Benni003

physX_open() calling again -> physic is not running - 01/09/14 00:24

Hi, I have the problem that the physic system isn't working after second call of physX_open(). I made an example:

//---------------
1: (Working)

physX_close();

wait(5);

ph_fps_max_lock = 60;
pX_setgravity(vector(0,0,-5));
physX_open();

//-----------------
2: (Not Working)

ph_fps_max_lock = 60;
pX_setgravity(vector(0,0,-5));
physX_open();

wait(5);

physX_close();

wait(5);

ph_fps_max_lock = 60;
pX_setgravity(vector(0,0,-5));
physX_open();
//-------------------

hm does anyone know why it's not working? I really need it. After returning from level my code closes the physicsystem... after loading a new Level again starting with physX_open().
Where is the problem?
Posted By: Superku

Re: physX_open() calling again -> physic is not running - 01/09/14 04:48

You could check ackphysX.h/c from the include folder and the code of physX_open.
Why do you need to close physX anyway?
Posted By: Benni003

Re: physX_open() calling again -> physic is not running - 01/09/14 08:59

Hi, I've checked already achphysX.h, but I couldn't find the problem smirk I need to close physX, because after this I call proc_kill(16); Its to kill all functions when returning from Level to main menu
Posted By: Superku

Re: physX_open() calling again -> physic is not running - 01/09/14 09:09

This may not help you a lot but I think that's a pretty inelegant solution. All non-global functions will stop on level load either way, so you only have to stop global functions manually (which you barely need to). I do this with a do_exit variable (thus while(!do_exit)...) which I set to 1 prior to level_load and reset it one frame later.
Posted By: Benni003

Re: physX_open() calling again -> physic is not running - 01/09/14 09:42

yes, thank you. I could do this, but I worked my problem. I dont use physX_close. I just call a function with following after proc_kill(16):
while(1)
{
physX_run(time_step/16);
wait(1);
}
Everything is working now laugh
© 2024 lite-C Forums