Start BulletSolver simulation when PerformMode start

Hi!

I’m making a game with collisions using BulletSolver. However, I can’t start perform mode before click on start simulation.

So, I create a Dat text on my perform window level with the next script, but it isn’t working:

If op(‘perform’).par.perform==True:
Op(‘project1/bullet3’).par.start.pulse()

Thks in advance,

Chava

does the solver get initted first?
you may want to init and then add some delayFrames before starting it:

op(‘project1/bullet3’).par.init.pulse()
run(‘op(“project1/bullet3”).par.start.pulse()’, delayFrames = 10)

to check if you are in perform mode, place a Perform CHOP and set it to only output the “Perform Mode” channel. To execute some python code whenever you start perform mode, connect a Chop Execute DAT to that CHOP output, and add your code within its onOffToOn function.

Example attached which restarts a Bullet solver on starting perform mode:
act_on_start_perform_mode.toe (5.9 KB)

Ty, perfect. I solved it with other external trigger, but yours is the elegant way.

thks

I just implemented your perform mode for a solver, and works excellent. Thank you very much.

I just buy a commercial license because I will do an installation. I will copy all the folder with assets, however, I will use a player. Do I need to change path of all my files, or touch recognize the folder project, or is there a way to collect my project in order to dont lose any path?

thks in advance.

The best thing to do is to use relative paths for all your assets. This way it is easy to move the project to another machine. Everything works the same for TouchPlayer.

The folder where the .toe file resides is called the project folder.
Place all your assets in subdirectories of this folder, for instance a folder “assets” which has another subdirectory “movies”.
Then load your assets in the Movie File in TOP(and others) by using a file path like: assets/movies/mymovie.mov

Also you can get the path of the current project folder in Python by using project.folder
See the Project Class wiki page

Hi, I implement the act on star perform mode, however, it is not working when I start in perform mode or player mode. Is only working from design mode to perform mode.

I’m not sure what you mean.
But the Perform CHOP shows you if you are in Perform mode yes or no, and the script triggers only when that channel goes from 0 to 1. This is useful in TouchDesigner where you can switch between network editor (perform=0) to perform mode(perform=1)
TouchPlayer can only run in perform mode (there is no network editor in TouchPlayer) so I guess the perform channel will always be 1 in TouchPlayer, so it will never switch from 0 to 1, so your reset script will not be triggered.

So when would you like to trigger that reset in TouchPlayer? Upon start? Use an Execute DAT for that and toggle the ‘on start’.
Does that help?

Hi, exactly, i want to trigger the reset upon start. I’ll try an Execute DAT toggle the ‘on start’.

Thks.