[BEHAVIOR] Chipmunk Physics

  • R0J0hound - how would you move the square around to follow the mouse via velocity and acceleration?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • justifun

    First you need to make the box movable.

    velocity way:

    set velocity to rect((mouse.x-sprite.x)*10, (box.y-box.y)*10)

    and set it to 0 when not dragging

    acceleration way:

    Keep the box from falling from gravity with:

    on box prestep

    --- apply force rect(0, -gravity*mass)

    and give the box a max speed at the start of the layout.

    then to move:

    apply force rect((mouse.x-sprite.x)*1000, (box.y-box.y)*1000)

    and when not dragging give a slowing force.

    apply force rect( -velocityx*1000, velocityy*1000)

  • R0J0hound - ill give it a go! I would have never guessed that. I'm new to the physics stuff.

  • How do I get to use the Chipmunk Physics with construct 2?

  • jkleffel

    You can download it in the first post. There's also a sticky topic on how to install plugins.

  • Is it possible to get a perfect ellipse collision? Tried scaling vertically an object with circle collision shape, but it does not work.

  • Aritz

    You'll have to approximate it with a polygon. Both chipmunk and box2d only do circles and polygons.

  • I supposed that, but thank for the reply!

  • I am a bit puzzled here.

    I always thought that changing the gravity of one object does not change the gravity of the other objects.

    Apparently, it does, change the gravity in one object and you do for all objects.

    As shown in this capx:

    https://drive.google.com/open?id=0B1SSu ... 25zZkRiQWs

    But i dont really like that idea. I like things to be consequent. Pick an object and the actions run on that object only. After all gravity is no more then a force as all forces.

    So i wend to chipmunk.

    https://drive.google.com/open?id=0B1SSu ... jlON3VQMkU

    To my suprise, it does the same.

    So i have two question, if that is ok.

    1/ Why is it logic that there is only 1 gravity? There is probaly i good reason that i cant find.

    2/ Why does the red object in chipmunk waits with falling until it is touched by another physics enabled object ?

  • 99Instances2Go

    1)

    Gravity is an acceleration and is the same for everything so it makes sense to affect everything.

    2)

    I can't look at the capx but it probably has to do with sleeping. Sleeping is an optimization where if an object stops it can be put in an idle state so calculations don't have to be done on them. It then wakes up if anything moving touches it or you move it. You can adjust how likely objects will fall asleep.

  • ty

  • Guys, hello! What do you think because of the chipmunk may have problems with canvas +? When I pick up on vebviev + everything works fine, but with canvas + Black Screen saver field cocoon. Configure the project as it is necessary, with a black screen topic has already been uvas! But there about chiptyunk neither of which is not written!

    Ребята, привет! как вы думаете из-за chipmunk могуть быть проблемы с канвас+ ? Когда я собираю на вебвиев+ все работает отлично, но с канвас+ черный экран поле заставки кокон. Настроил проект так как нужно, тема с черным экраном уже была увас! Но там про чиптюнк ни чего не написано!

  • Might there be any chance of us getting angular dampening included in the near future? I know we can manually do it by having an opposing angular force, but it's just nice having it as a feature in box2d.

  • RashidBASHLY

    There shouldn't be an issue with canvas+ since this plugin makes no use of drawing. Only js is used. Also I only use html5 and nwjs exports.

    AnD4D

    I probably won't be getting around to this any time soon as I don't have a lot of time lately.

  • R0J0hound Ah, I see... Well what you've done is greatly appreciated

    I have noted what might be a bug if you're interested. I tried to change an objects mass using runtime, and an error message popped up. Perhaps this isn't a bug, but it seemed strange. I'll need to figure out another way to achieve this effect.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)