Is there a way to check area of a sprite object?

Get help using Construct 2

Post » Wed Oct 10, 2012 11:13 am

I mean an easy way to check the area of collision box (this is the one that matters for physics behavior, right?)? And a way to set it exactly as i need to? Like in Solid Works - you can right click on object and in properties menu see it's area in square meters. Or if i can access it as a variable it would be even better.
B
3
Posts: 6
Reputation: 412

Post » Wed Oct 10, 2012 11:25 am

Why exactly do you need this? Just curious.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Oct 10, 2012 11:34 am

Well i need to be able to tell the mass of an object. As i understand forces in construct 2 are calculated by [mass * acceleration] not [density * acceleration]. And it's just much easier to do physics simulation when you know how exactly objects of specific masses would interact with each other from your "on paper" calculations.
B
3
Posts: 6
Reputation: 412

Post » Wed Oct 10, 2012 12:39 pm

I guess it would be:

<Area of collision polygon> * density = mass

Check the collision polygons, if they are simple, then you are in luck.
B
22
S
7
G
3
Posts: 189
Reputation: 4,270

Post » Thu Oct 11, 2012 1:07 pm

That's really nice, but it doesn't answer my question even a little bit. What i need is to be able to check the area of my collision polygon in square units. I need to know if there is a property of an object i can address for it?
B
3
Posts: 6
Reputation: 412

Post » Thu Oct 11, 2012 1:49 pm

If you can't find anything, you could do it the old-fashioned way. (Object.height *object.width) to get it in pixels. Then you can do any math you'd like.
B
90
S
32
G
14
Posts: 935
Reputation: 14,540

Post » Thu Oct 11, 2012 2:52 pm

Yeap i understand this much , but i hoped that someone knows some easy method for this already implemented in construct 2.
B
3
Posts: 6
Reputation: 412

Post » Thu Oct 11, 2012 5:21 pm

I guess i'll have to figure it out empirically - first i'll smash two equal (density, collision polygon size, bounciness) ball sprites with physics behavior into each other at certain speed and see at which speed they will bounce then try to recreate same speed with "apply impulse" action.
But this is really stupid, because Construct 2 already using area of collision polygon to calculate physics interaction between objects, so why the hell there is no way for me to access that data and use it??! Just ridiculous! I just hope my topic won't be buried under all these star-marked topics and developers will see it.
B
3
Posts: 6
Reputation: 412

Post » Thu Oct 11, 2012 6:59 pm

There is the Sprite.Physics.Mass expression which is equal to density * area. Why not use that?
B
79
S
24
G
54
Posts: 4,753
Reputation: 40,769

Post » Mon Oct 15, 2012 10:10 am

Didn't know about that sprite.physics.mass and .density are there. Thank you. Problem solved .
B
3
Posts: 6
Reputation: 412

Next

Return to How do I....?

Who is online

Users browsing this forum: Vegamon007 and 18 guests