Physics weirdness with custom collision + physics questions

This forum is currently in read-only mode.
From the Asset Store
Everything is made via physics, Very simple code: 6 events only (3 for tank creation, 2 for controls and 1 for camera)
  • Noticed something weird going on with custom collisions and physics

    Download:Example Really simple example cap to show the problem.

    The custom collision is setup correctly around the object following the mouse, but when it's run, the collision shape is somewhere above the object. The hotspot has to be where it is (think of it like a paddle in a pinball game, rotating at that point, even though it doesn't in this example).

    Is this a known issue or did I just set something up wrong?

    Also three questions

    1 ) How do you increase the accuracy of the physics. I've seen other people's examples and objects bounce and collide perfectly, even with tons of physics objects all interacting at once, without any of them passing through each other or acting weirdly, yet whenever I've tried to do the same, objects just snap and bug out much of the time and the physics come across as incredibly flakey for me. I've set the World Solver and World Friction to their highest setting and seen no improvement. I've used objects that aren't any different in mass or size (I read about that issue on the wiki and made sure to check it wasn't that). I just can't seem to make them behave like other people can, even when I attempt to mimic what they did in their exe's. Does it need something to do with timedelta? I know it's not my machine, as like I say, others have worked fine for me.

    2 ) Are there issues with physics objects and mouse control? Again, seems flakey for me when I use it, yet I've seen it in others creations that appear to work and behave just fine (one had leaves being pulled about with a mouse (which is moved about quickly) and lots of physics going on and looked flawless). So I'm clearly doing something wrong.

    3 ) Tiny request, not a big deal, more curiosity really. Will there eventually be an option with creating custom collisions to drag the points around after creating them, as opposed to the current method of having to delete them all to go back to one you want to change.

  • As far as I know the hotspot for any physics object needs to be centered in order for the collision to work properly. If I remember correctly this has something to do with the way Box2D works.

    If you need the hotspot at the edge of the flipper for whatever reason then make your sprite like so:

    <img src="http://i45.tinypic.com/i6clc9.png">

    Then when you draw your custom collision mask in the layout, just place your points around the colored area like normal.

    1 ) How do you increase the accuracy of the physics.

    It's hard to say without a .cap to look at to see what's wrong.

    2 ) Are there issues with physics objects and mouse control? Again, seems flakey for me when I use it

    Yes. If you manually move a physics object with the mouse or a behavior or by updating it's coordinates in any way except with physics itself, then you will get weird collisions. Also, when you manually move the flipper against the ball with the mouse, the flipper has no force, so it's not actually "hitting" the ball. You're just intersecting the flipper and the ball. The ball and the flipper are trying to push out of each other, but the mouse behavior is overriding it's position.

    Here's a method for moving physics object around with the mouse that may suit your needs:

    http://dl.dropbox.com/u/529356/dragandtoss.cap

    It's got a little bit of lag behind the mouse but it works pretty well.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As far as I know the hotspot for any physics object needs to be centered in order for the collision to work properly. If I remember correctly this has something to do with the way Box2D works.

    If you need the hotspot at the edge of the flipper for whatever reason then make your sprite like so:

    <img src="http://i45.tinypic.com/i6clc9.png">

    Then when you draw your custom collision mask in the layout, just place your points around the colored area like normal.

    Ahhhh! Ok that makes complete sense now, I see where I was going wrong (didn't think the hotspot location would matter, but yep, that's the problem right there). Neat way to fix it too, didn't think of doing it that way either. Awesome!

    > 1 ) How do you increase the accuracy of the physics.

    >

    It's hard to say without a .cap to look at to see what's wrong.

    No need, you practically answered, fixed and showed a better way for that question below (it's cause I often test stuff using the mouse behavior for speeds sake, and that's where I was screwing up when it came to physics). A classic case of the error being between the computer and the chair.

    > 2 ) Are there issues with physics objects and mouse control? Again, seems flakey for me when I use it

    >

    Yes. If you manually move a physics object with the mouse or a behavior or by updating it's coordinates in any way except with physics itself, then you will get weird collisions. Also, when you manually move the flipper against the ball with the mouse, the flipper has no force, so it's not actually "hitting" the ball. You're just intersecting the flipper and the ball. The ball and the flipper are trying to push out of each other, but the mouse behavior is overriding it's position.

    Here's a method for moving physics object around with the mouse that may suit your needs:

    http://dl.dropbox.com/u/529356/dragandtoss.cap

    It's got a little bit of lag behind the mouse but it works pretty well.

    *sigh* So simple and yet so perfect.

    Thank you so much!!!

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