Physics questions.

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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.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.

  • 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.

  • Changing these settings would take away the point of physics.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.

  • 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.

  • 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.

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