Skip to content
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

How do I check if the engine is running? Where's engine.enabled flag? Runner can't be stopped? Or always reporting 'enabled === true'? #586

Closed
jared83 opened this issue Mar 14, 2018 · 4 comments
Labels

Comments

@jared83
Copy link

jared83 commented Mar 14, 2018

The following illustrates and documents problems I am experiencing:

this.engine = Engine.create()
...
		let runner = Runner.create()
		Runner.run(runner,this.engine) // even if commented out...
		Runner.stop(runner) // even if commented out...
		console.log(runner.enabled) // ...true, true, still true, always true...
		console.log(this.engine.enabled) // undefined Why? How do I check if the engine is running?
		console.log(runner)
		runner.enabled = false
		console.log(runner.enabled) // now it's false, but has it really stopped (and stopped the engine too)?

Basically, I am writing unit tests for my app, and I need to know that the engine is running at a given point in the app's execution.

@liabru
Copy link
Owner

liabru commented Mar 26, 2018

There's nothing built in to track this, the runner.enabled property is just used for pausing during running, so it will always be true unless you set it to false to pause. You'll have to track it yourself for now, but I'll add this as a feature request.

@jared83
Copy link
Author

jared83 commented Mar 27, 2018

Lovely! Thank you so much liabru!
BTW. Looking forward to those cued PR to be merged into the next ver. of Matter.js.
Looks to me like many of them will give it a nice performance boost.
Currently, even about 100 bodies bouncing around make a slightly aged mobile to stutter.
cheers

@bouraqadi
Copy link

There is no more in .
To pause/resume simulation I am using Runner.stop() and Runner.start(). But, according to the documentation, I should be using engine.enabled property. However, it is undefined in 0.14.2 and in 0.10 too.

@liabru
Copy link
Owner

liabru commented Jul 19, 2018

Oh my bad, I actually meant to say runner.enabled, try that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants