Physics questions.

Get help using Construct 2

Post » Wed May 29, 2013 7:33 am

I'm having some serious issues with the Physics in C2.

I think I'm just not understanding how they work on a fundamental level I suppose. Maybe someone can educate me on this subject a bit?

One of my big questions is why does adjusting the collision mask on a sprite affect the physics? To me that makes every single option with the behavior such as density, damping etc completely pointless. Shouldn't a collision mask handle collisions and ONLY collisions? Why does that have any effect on how the object behaves when physics are applied?

I spent hours tweaking the values on a physics enabled sprite to get the way it performs just right, only to have all that work negated later when I moved a single collision point around. I guess I just don't get the logic there.

Also something I don't understand is in a top down shooter game I'm working on the player ship is controlled by physics, however any kind of collision mask OTHER than a bounding box will cause the sprite to just fly all over the place when you press the move key.

I'm applying physics to the sprite's origin point, directly in the middle...so why would a different shaped collision mask have any affect on that? Using a box shaped mask is out of the question...but if I don't then you don't have proper control over the sprite.

Are there any ways around this?
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Wed May 29, 2013 9:32 am

As far as i know the size of the collision mask dictates the objects mass, so altering that will change its mass and the way it reacts to forces. I assume it also changes the center of gravity.

It may be possible, depending on what you are trying to achieve, to pin a seperate sprite to your physics object and use the collision mask on that instead.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Wed May 29, 2013 10:10 am

That's really bizarre, that makes sense but it's still weird.

If it changes the objects mass (which it obviously does) then what function does the density parameter serve? As for the center of gravity, shouldn't that always be the objects origin point?

Maybe I'm being too logical here? It just seems to me that a collision mask should just handle collisions. I wish there was a way too turn this functionality off.
B
19
S
7
G
10
Posts: 82
Reputation: 4,996

Post » Tue Sep 10, 2013 7:05 am

This is a huge problem for me. Is there really no way to turn off this mass=size thing? In real word this may be how things works, but in games it should be all about accurate numbers.nemo2013-09-10 07:08:05
B
43
S
5
G
5
Posts: 410
Reputation: 5,742

Post » Tue Sep 10, 2013 7:16 am

[QUOTE=nemo] This is a huge problem for me. Is there really no way to turn off this mass=size thing? In real word this may be how things works, but in games it should be all about accurate numbers.[/QUOTE] I think there is if you don't mind some effort.
From the manual: "The object mass is calculated as its density multiplied by the area of its collision mask"
So, in theory you should be able to have it any mass you like. A 32x32 collision mask with a density of 1 will have a lower mass than a 32x32 collision mask with a density of 2.
You'd only need to have a concept about your object's masses and then accurately calculate them to be able to set the density parameter accordingly.
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279

Post » Tue Sep 10, 2013 8:48 am

The physics behaviour is meant to mimic real life physics in a 2D environment.

A bigger object (one with a bigger collision polygon) behaves different from a smaller one. Also when you have a vase, for instance, its point of gravity won't be at the neck.

Changing these settings would take away the point of physics.

If you want a limited form of physics and not have it behave "realistically" it would probably be better to write your own custom movement. I've done it before and it gives you a lot more influence as a programmer.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 10, 2013 9:37 am

[QUOTE=LittleStain]Changing these settings would take away the point of physics.[/QUOTE] Nobody's changing these settings.
But not using the density parameter to adjust your object's weight is exactly the opposite: you're falsifying physics.
For example, there's a crate filled with iron bars, and a second one right beside it, filled with nothing. They both look the same, but they aren't. Not changing the density will make them behave all the same - which simply is wrong.
That's what the density parameter is for.tulamide2013-09-10 09:38:27
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279

Post » Tue Sep 10, 2013 9:59 am

@Tulamide, I think you misunderstood me.

The density settings are exactly for what you are talking about. I meant it's only "natural" the shape of an object (the collision-polygon) has an effect on the physics. Both the point of gravity and it's "mass" should be related to it.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 10, 2013 2:31 pm

@LittleStain
You're right. I really thought you were trying to argue against the use of 'density'. I have to apologize. Also, I totally agree to
I meant it's only "natural" the shape of an object (the collision-polygon) has an effect on the physics. Both the point of gravity and it's "mass" should be related to it.
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, ilyaTyl and 11 guests