Coder Social home page Coder Social logo

Comments (8)

shakiba avatar shakiba commented on May 22, 2024 3

Here is a working demo: https://piqnt.com/space/1ICyExOEW

The only caveat was that you need to awake at least one of the bodies after setPosition().
I update the code to do that automatically on setTransform/setPosition/setAngle

from planck.js.

shakiba avatar shakiba commented on May 22, 2024 1

The first teleport actually works fine in the link. I will make an example to see how things are.

from planck.js.

quinton-ashley avatar quinton-ashley commented on May 22, 2024 1

@shakiba wow this is a small fix that opens up a huge range of opportunities for use in games. Thank you!

from planck.js.

shakiba avatar shakiba commented on May 22, 2024

I guess I don't know the answer! However I recommend to first search if it is possible with Box2D, and if it is then share a sample here so that I can have look.

from planck.js.

shakiba avatar shakiba commented on May 22, 2024

I just revisited this issue and read it more carefully, I think it should not be difficult to fix. If you have not solved this issue yet, can you please share a sample l can test?

from planck.js.

quinton-ashley avatar quinton-ashley commented on May 22, 2024

I have noticed this to, it's still an issue. You can workaround it by setting the velocity instead of position but it shouldn't be necessary imo.

from planck.js.

shakiba avatar shakiba commented on May 22, 2024

I guess the main issue here is updating c_position.c, you would need to use Body.setPosition() or Body.setTransform().

from planck.js.

quinton-ashley avatar quinton-ashley commented on May 22, 2024

Well that doesn't work either cause I use body.setPosition. I just call it "teleporting" check out the second example:
https://p5play.org/learn/sprite.html?page=2

from planck.js.

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.