Physics question on spinning and collisions

0 favourites
  • 3 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Hello,

    I saw a .capx in the FAQ and few posts about how to make the slash effect from Fruit Ninja. But I didn't find anything helpful for generating the fruits. So I tried to make one and if you can help me fix it then maybe it can be added to the FAQ.

    Here is the dropbox link.

    What does it do?

    1. Updates the variable Random_int every tick.

    2. Every y seconds, if Random_int is above a constant threshold then create a new fruit below the canvas.

    3. The x-coordinate origin point of the new fruit is randomized using choose().

    4. Hit each new fruit with an upward impulse. The impulse is randomized by choose() so the flight paths are different.

    5. Fruit is destroyed if it falls below a certain y-coordinate.

    Problems and Questions (need your help):

    1. The fruits are spinning like crazy. I have set Angular Damping to 1 but they are still spinning too fast. I found an alternative: set Prevent Rotation to 1 and faking the rotation by setting Angular Velocity. But I rather figure out how to rotate using impulse.

    2. How do I disable collision? I don't want the fruit to run into each other.

    3. Changing the size of the sprite and collision box changes the mass, which requires adjusting the size of the impulse through trial and error. Otherwise the fruit just flies off the screen or goes no where. Is there another way to determine the impulse strength?

    4. I care about performance because I want to release this game on mobile devices. Is there a more optimized way to create and destroy the fruit? Better way to randomize the fruits' origins?

    Thank You,


  • Let me rephrase the question:

    1. How do I prevent the sprites from spinning so fast?

    2. How can I prevent the sprites from colliding with each other?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could choose not to use physics (If you want to play on mobile this is alkmost always the best choice)

    I would:

    Make a fruitbox (invisible sprite to pin the fruit on)

    give it bullet behaviour and turn on gravity for the behaviour.

    Pin the fruit on the fruitbox (position only)

    give the fruit sine behaviour to spin it.

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