GithubHelp home page GithubHelp logo

Comments (3)

chandlerprall avatar chandlerprall commented on July 23, 2024

I won't get a good chance to look into this for a couple more days but my guess is you need to enable CCD (continous collision detection).

from physijs.

chandlerprall avatar chandlerprall commented on July 23, 2024

Watching the game play, I don't think the ball starts moving fast enough to need CCD. However, I think the same concept is the fault.

By default, when you call the simulate() method, Physijs will simulate all of the time which has transpired since the last call. If there is a lag between calls then the entire period will be simulated. In theory this is great. However, in practice these lags will start compounding because processing times take longer and longer, and is why in the demos I use simulate( undefined, 2 ). The first parameter specifies how long of a period to simulate, with undefined meaning "all time since last call". The second parameter, 2, limits the maximum number of frames to simulate. This eliminates lag introduced by subsequent cpu-intensive calls. Adding undefined, 2 may solve your issue.

I would also recommend grabbing an updated copy of both physi.js and physijs_worker.js - I updated the library a couple of days ago with some optimizations to keep things smoother. I also changed when the simulate method is called in the examples.

from physijs.

yazgoo avatar yazgoo commented on July 23, 2024

Thanks for your answers,

I've both updated physi*.js and my code (in my last push) to use simulate(undefined, 2) (calling it from a scene.addEventListener('update'… callback instead of doing it in the render function itself.
However, the marble still passes through sometimes.

from physijs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.