Apply force to the centre of a 3x3 pixel object

0 favourites
  • 7 posts
From the Asset Store
Build a thrilling space station scenario with these level assets and characters.
  • Hi all

    Is it possible to apply a Physics Force to the exact centre of a Sprite if the Sprite is an odd number of pixels high/wide?

    So, for example, let's say I have a 3x3 square. Is there some way to apply a single force to the centre of the object?

    It appears that while collision polygon points can be assigned to half pixel positions, origins and image points cannot so there seems to be no way to apply a force to the centre...

  • Yes, because you apply the force to the centre of mass. ... .capx?dl=0

  • Thanks for your response 99Instances2Go.

    So I now see from your capx how to find the centre of mass of an odd pixel-sized object. However I'm still unsure how this translates into applying a force to that point?

    Unless I'm missing something, the apply force dialogue box implies you can only set the position of application to the origin or an image point.

  • ... .capx?dl=0

    Read the manual when its jabbering about the Joints on the page for Physics.

  • Ah, okay! I do recall reading that bit in the manual but I (incorrectly) assumed it was specific to joints. It doesn't make a lot of sense to me having 0 specify the centre of mass/gravity and -1 specify the origin when the origin is image point 0 but there we go! I think I may have actually tried -1 previously hoping that might specify centre of gravity and obviously didn't get the desired result. Thanks!

    Modifying my original question for a moment and making the shape say a rectangle of 4x3 px, is there some way to apply a force to the centre of mass for one dimension but not the other? So, applying a force to 1, 1.5 px for example.

  • Yes and no.

    If the collision polygon dont matter. Yes. Just make the polygon 2x3.

    Else. No. Not that i know.

    Unless (i not gonna try it) the following works.

    2 objects. 1 with collision polygon 2x3. 1 with the desired collision polygon. Hinge (got to error and try witch hinge, i dont know, probably with a constraint angle) them. See if the collisions for the second object do effect the first object in a correct way. Would be the equivalent of a pinning a face object on a helper object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah yes, I should have specified that the collision polygon does matter.

    I did wonder whether there was some way of pinning two physics objects together to achieve this. I'll have a play around with your suggestion, thanks.

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