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

Physic simulation runs twice #29

Open
rikard-io opened this issue Nov 8, 2017 · 6 comments
Open

Physic simulation runs twice #29

rikard-io opened this issue Nov 8, 2017 · 6 comments

Comments

@rikard-io
Copy link

rikard-io commented Nov 8, 2017

  • Device Model: iPhone 7
  • Xcode Version: 9.1
  • iOS Version: 11.1
  • Pod Version or Repo Commit: 1.4.2

Running with ARKit and rendering a ARSCNView

Issue Details:
Seems like the physic simulation gets run twice, once in the actual sceneView rendering and once in the SCNRenderer when recording. This results in a speedup in any physics-driven motion

Temporary and ugly workaround is to set physic simulation speed to half before recording and restore after recording is finished. (sceneView.scene.physicsWorld.speed = 0.5)

Might be somewhat related to #28

Thanks for a very useful lib!

@Francescu
Copy link

To complete @rikardjh's workaround, for particles:

            if recording {
                self.rootNode.particleSystems?.forEach { particle in
                    particle.speedFactor = particle.speedFactor / 2.0
                }
            }
            else {
                self.rootNode.particleSystems?.forEach { particle in
                    particle.speedFactor = particle.speedFactor * 2.0
                }
            }

@okaris
Copy link
Contributor

okaris commented Nov 20, 2017

I am looking for a solution that doesn't require manually manipulating the speed factor. If I can't find in a timeful manner I will add this as a temporary solution.

@kyleweiner
Copy link

@okaris Has there been any progress on this issue or is manually manipulating properties for the recording state still the recommended solution?

@Francescu Curious if you’re using this workaround in Arrow. Very fun app by the way!

@okaris
Copy link
Contributor

okaris commented May 22, 2018

I don't remember finding a solution for this. I am no longer maintaining this repo. Maybe @halileohalilei can help.

@Francescu
Copy link

@kyleweiner thanks for the kind words 😇

The trick is still used in production for the Arrow app 🙈

@kyleweiner
Copy link

Looks like it gets the job done for now. Thanks for the info 👍

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

No branches or pull requests

4 participants