Apply force to the centre of a 3x3 pixel object

Get help using Construct 2

Post » Thu Jul 20, 2017 3:56 pm

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...
B
4
S
1
Posts: 9
Reputation: 318

Post » Thu Jul 20, 2017 10:52 pm

Yes, because you apply the force to the centre of mass.

https://www.dropbox.com/s/lhpbwe29vo3ph ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jul 21, 2017 10:53 am

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.
B
4
S
1
Posts: 9
Reputation: 318

Post » Fri Jul 21, 2017 4:28 pm

https://www.dropbox.com/s/da8fix6x6chc1 ... .capx?dl=0

Read the manual when its jabbering about the Joints on the page for Physics.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jul 25, 2017 9:50 pm

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.
B
4
S
1
Posts: 9
Reputation: 318

Post » Tue Jul 25, 2017 10:12 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jul 25, 2017 10:21 pm

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.
B
4
S
1
Posts: 9
Reputation: 318


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests