Collision Polygon and physics results in awkward movement

Get help using Construct 2

Post » Thu Jul 13, 2017 11:51 am

Now i understand the problem. I apologize for not getting it earlier.
The reason for this is that the force is pushes from the center of mass and the rotation takes the origin.

But lets first go the path that you started. starting from the collision polygon.
Lets explore the center of mass, see if it drifts.

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

It does not. It is pretty stable. But it is a little of do inevitable floating point calculations.
Is that enough to cause a torque when applying a force ?

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

Darn it, yes it does. So in some way, your guts are right.

Same problem when we use an exact imagepoint ?

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

Nope, not at all. So it kinda a butterfly effect, a little mathematical error that cause big changes.
I have no idea if it possible to do this better. In real life it is not possible, just less noticeable do the proportions of mass, forces, gravity ..... and so on.

Question remains, is this the cause of the problem we face.

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

No, no, i still notice drifting. An that is because the rotation gripes on the origin and the force gripes on an imagepoint that is not the origin. Those forces do not balance out.
But, we can not rotate an object with the center of mass as origin. Well, in a way we can, just set a torque towards the mouse coordinates on that layer. But then i dont know how to avoid the wobbling, the torque will always overshoot a little.

So, we have no other chance (but i am not the smartest in here, maybe someone knows how to stop the wobble) then taking the two system apart. The 'system that rotates in tick steps' and the 'physics system'.

Here goes:

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

Hope this explanation satisfies you.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jul 13, 2017 1:20 pm

99Instances2Go wrote:Now i understand the problem. I apologize for not getting it earlier.
The reason for this is that the force is pushes from the center of mass and the rotation takes the origin.

But lets first go the path that you started. starting from the collision polygon.
Lets explore the center of mass, see if it drifts.

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

It does not. It is pretty stable. But it is a little of do inevitable floating point calculations.
Is that enough to cause a torque when applying a force ?

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

Darn it, yes it does. So in some way, your guts are right.

Same problem when we use an exact imagepoint ?

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

Nope, not at all. So it kinda a butterfly effect, a little mathematical error that cause big changes.
I have no idea if it possible to do this better. In real life it is not possible, just less noticeable do the proportions of mass, forces, gravity ..... and so on.

Question remains, is this the cause of the problem we face.

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

No, no, i still notice drifting. An that is because the rotation gripes on the origin and the force gripes on an imagepoint that is not the origin. Those forces do not balance out.
But, we can not rotate an object with the center of mass as origin. Well, in a way we can, just set a torque towards the mouse coordinates on that layer. But then i dont know how to avoid the wobbling, the torque will always overshoot a little.

So, we have no other chance (but i am not the smartest in here, maybe someone knows how to stop the wobble) then taking the two system apart. The 'system that rotates in tick steps' and the 'physics system'.

Here goes:

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

Hope this explanation satisfies you.


No worries about the misunderstanding, I really appreciate the input!
There is still some drifting and wobbling, although certainly much less now.

Knowing that this issue is a result of the two forces being applied to two different points gives me something I can work with when it comes to problem solving. However I'm not sure why that is an issue when a collision polygon is being used but not an issue when a circle or bounding box is being used.

Either way I'll get back to you if I ever figure out how to solve this issue completely. Can't help but feel like there must be a simpler way to do this.

You've given me a lot of information to work with, thank you so much
B
11
S
4
G
4
Posts: 28
Reputation: 2,831

Post » Thu Jul 13, 2017 5:59 pm

This is the most accurate version i can make with my simple talents.

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

The angle is always calculated with the same, non outgrowing, distances.
When doing this on the parallaxing layer the little errors get bigger when it gets far away from the layout origin.
The centre of mass is not used. I just can not get it done when using the centre of mass.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jul 14, 2017 12:36 am

99Instances2Go wrote:This is the most accurate version i can make with my simple talents.

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

The angle is always calculated with the same, non outgrowing, distances.
When doing this on the parallaxing layer the little errors get bigger when it gets far away from the layout origin.
The centre of mass is not used. I just can not get it done when using the centre of mass.


The second to last one actually had the least drift, but I think we might be approaching this all wrong. Even if the drifting is caused by the two forces acting on two different points, this issue doesn't exist when using a bounding box or circle and for that reason I'm pretty sure its a bug.

So I filled out a bug report, and hopefully it can be fixed before I lose my mind trying to figure out how to get physics objects using collision polygons to move the way they're supposed.

Thanks again for all your help, I'm going to continue working on this until I find a work around or the bug gets fixed. I've learned some important things about layer coordinates and how the physics engine works through this!
B
11
S
4
G
4
Posts: 28
Reputation: 2,831

Previous

Return to How do I....?

Who is online

Users browsing this forum: dop2000, hrisnz and 8 guests