Physics Issue with Object Position

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I've been working on moving my game over to Construct and I noticed that there is a bizarre issue with the Physics system. I've tested a couple of times and have come to the conclusion that when an object has Physics enabled on it, the Position of the object gets skewed slightly. For example, say you create a box, 80x80, place it on a layout in the middle of a 640x360 Layout at exactly 320x180. You have the Physics Behavior and have Enabled turned off, set to Inmovable and World Gravity set to 0. I have a Keyboard set to enable the physics on the object as soon as you push it. Upon loading the game in debug, we can see the object at 320x180. As soon as you hit the Key to enable Gravity, the Objects position goes to

    X: 320.0000047683716

    Y: 179.99999523162842

    I'll post this as a Bug to Construct but this is something that needs to be fixed. I was previously using GameMaker for my game and I was not getting anything like this. I strongly believe that the Physics Engine for Construct needs to be seriously looked at and implemented better.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I understand your frustration, and I just checked it and it really happens 100% of the time.

    I have one question, though. Does such a small deviation, one hundred thousandth of a pixel, have any impact whatsoever?

    Just curious. :)

    Cheers!

  • It does when your trying to align and keep stuff aligned correctly. It also helps with the presentation of the game because stuff doesn’t look out of aligned. Let’s say you position 9 books in a row. I’ll use a for loop “i” 0 to nBooks -1

    I then take the starting x position + (i * bookwidth) With no physics the books all line up neatly in a row. With physics enabled by the 4th or 5th they start looking out of place which in my case that’s what I was seeing in my game although I’m not doing this with books. That was just a hypothetical example.

  • Most fractional calculations in computers are imprecise like this. It's literally the CPU circuitry that does this, so all software on all computers is affected.

    Does it matter? You're talking about a difference of 0.000004 pixels, which is far too small to be visible.

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