Physics sprite stuck on other sprite

0 favourites
  • 5 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Hello - This is my first post on the forum. So tell me if its the wrong place to post or anything.

    Anyway - to the case:

    I've been tinkering with a pinball-game. The problem: The ball-sprite (when moving really fast) sometimes got stuck on a star-shaped sprite (with physics-behavior). I went a bit loopy trying to figure out why/how to fix it. I tried all sorts of things, like changing the physics parameters of the ball - AND the star it got stuck in (angular damping/density/whatev - but nothing really worked (or it worked but the game then didn't perform as I wanted it to) - and I searched a lot on the c3-forums but nothing I found helped.

    Then I got to thinking: The walls/flippers/objects all had really simple collision-polygons - either a circle or just a few collision-points. BUT - The star had many - (and rotating) so I thaught it might be that the processing/cpu just couldnt "keep up" - when and only when the ball was going really fast. So what I did was that I moved every collision-point of the star a little bit away from the sprite/image - so that the ball-sprite would have a few milliseconds more before "overlapping" the star (does that make sense?) Anyway - after I did that, it hasnt happened! (yet).

    So I thaught I'd post this if anybody else has the same problem.

    And if for some reason this makes no sense/is wrong and turns out to be a "placebo-effect" or wishful thinking - please let me know. (and why)

    Game can be played/tested on

    https://helledussen.com/spill/kpinball

    Primarily made for mobile device (tap on green "fish" to launch ball - then tap right/left sheep)

    But can also be played on pc (Space to launch ball - right/left arrow keys)

    Peace :-)

    Tagged:

  • How do you rotate the star - using Physics actions or some other behavior?

    Physics has a "Bullet" checkbox for fast moving objects, have you tried setting it on for the ball and the star?

  • I have this: On start of layout - Star-> Create Physics revolute joint at image point 0 to joint_star.

    I checked "bullet" on ball and star. It says it enhances collision detection - cool - Do you know what that means/does?

    I will continue to test and see if the problem is solved.

    Thanx!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It says it enhances collision detection - cool - Do you know what that means/does?

    I don't know the inner workings, but I guess it improves collision detection for fast moving physics objects, perhaps makes more checks per frame or something like that.

    Make sure you don't change position or angle of physics objects directly (by actions like Set Angle or Set Position), and you don't use other behaviors like Bullet or Rotate. Physics objects should only be controlled with physics actions.

  • It seems that the problem is solved! I've tested a lot (and have tried to get the ball moving as fast as possible on both mobile and pc) and it hasnt gotten stuck. So thank you SO much for the tip to tick "bullet" on the ball-sprite and star, that seems to have indeed done the trick.

    Much appreciated ! 🤗

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