[BEHAVIOR] Chipmunk Physics

  • ah, I just remembered I had this issue before and looked back through the thread and saw your post that helped me solve it:

    I re-added it to the new version at line 6548 and now things are working like before.

  • I'll be sure to reference that bit. However as I recall that's an incomplete fix that only updates the two objects connected to a joint. I'll try to come up with a list of the situations you'll need to update positions manually. Hopefully it's not too though.

  • I think the implementation of those two lines updates the two objects that collided. I don't think it relates to any joined objects in that case. At least, that is the impression I get.

    A list of situations would be interesting- the only place I've ran into the problem has been when objects are colliding, but I suppose there could be other situations too.

    Maybe I've ran into the problem in other situations but didn't notice it or maybe I overlooked it.

  • Prominent

    You're right that's what they do. I'll still want an action to update the object's c2 position or physics position for each other, but I need to do some refactoring, which is taking time, and i haven't been productive.

    Here's a slight breakdown of the limits of those triggers. Some of it can be fixed, but not all.

    pre step

    • can set forces here
    • setting position and angle is ignored here

    pre/post collide

    • setting forces is ignored here
    • setting position and angle is ignored here
    • position of objects aren't updated to correct locations at this point. The fix you linked only fixes this partially.
  • Ah cool, thanks for breaking that stuff down, I think I'm grasping the situation a bit more.

    This chipmunk behavior is really great, I have had a lot of fun experimenting with it and I'm looking forward to any new progress you make with it!

  • I really like the accuracy of chipmunk physics compared to Box2D in most of the aspects (especially the way collisions happen). Thanks a lot for giving us this plugin...

    R0J0hound, I wanted to show how the things around look like from a moving object (that has a behavior of chipmunk physics). More like a relative motion where I change the reference frame to a moving object...For example, the way the objects in the scene appear if I sit on a moving swing...

    Are the utility expressions "Worldtolocal" and "localtoworld" the ones that I need to use to translate other objects in the scene?

  • kmsravindra

    You should be able to do it by scrolling to the object and settig the layout or layer angle to be the same as that object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks I am trying to understand more about the utility expressions "Worldtolocal" and "localtoworld" and a use case context for the same...can you throw some light on that?

  • kmsravindra

    Those two expressions were for use when adding joints. They aren't needed now since I since came up with a better solution.

    Basically what they do is this.

    "World" is just your standard xy coordinates on the layout.

    "Local" is just a position relative to an object's location and rotation. If you're familiar with 3d programs the idea is similar. For example a local position of (100, 0) will always be 100 pixels in front of wherever the sprite is facing.

  • Good to know that! Thanks for your response.

  • R0J0hound

    Hi! Do you know how to integrate chipmunks and rts, for units not to walk on top of each other? Thx! xxx

  • megatronx

    Probably the same way as with the physics behavior. All physics objects will push out of each other. I haven't tried it so I don't know if there is any fighting between the behaviors that might make the objects jitter.

  • megatronx

    Probably the same way as with the physics behavior. All physics objects will push out of each other. I haven't tried it so I don't know if there is any fighting between the behaviors that might make the objects jitter.

    I tired setting it up myself, but I can't get it to work. :< Units either fall or overlap each other.

  • megatronx

    I guess it doesn't then. The solution would be to move it with physics instead of letting the pathfinder movement do it. You'll have to use the Sprite.pathfinding.nodexAt and nodeyat expressions to get the points along the path and come up with a way to move along it with physics. That way physics will be in full control of the object's motion and can keep the objects from overlapping.

    That's the idea at least. I don't have any working example.

  • I just tried and found a way to pull the physics object, I posted it in your other thread megatronx

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