why the shift (physics "set velocity" glitch)

This forum is currently in read-only mode.
From the Asset Store
Tweakable and easy to use effects for your projects.
  • I was trying to post a response to this post about rotation when I realized a glitchy kinda thing about physics I had noticed before but not so pronounced. why when I set velocity does the object shift position slightly before applying the velocity?

    click for cap

    in the above cap file, you'll see when you apply velocity to this object it's changes position, if you remove the line that sets velocity it's obvious even though there's a swap of objects it hasn't moved...I can't figure out any logic to where it moves either so I can't shift it back.. besides setting object position breaks the physics engine. but if you click over and over it seems random where it shifts to

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • due to the overwhelming response I thought I'd give an update to the question. I realized this only happens when replacing an object with a new object. I thought it might just be the result of starting an object from a stopping position, but this cap here:

    here

    shows that it's not. if anyone has any insight as to why the first cap does that shifty thing. It'd be much appreciated.

  • I have no idea why it's doing that.

  • i could only guess that the physics engine wants to have a word with you about spawning one box at the exact same position as another box. something about that being physically impossible :P

    but that's only a guess. i've got no idea when and how the physics engine is doing his thing, and if he can really catch you doing that in the timeframe of 2-3 events.

  • i could only guess that the physics engine wants to have a word with you about spawning one box at the exact same position as another box. something about that being physically impossible

    That's what I thought too, so I changed it up so that one box was destroyed before the other was created. It still did the jumpy thing :/

  • SOLVED!:

    tada!

    you have to disable collisions with other objects. I also had tried what deadeye said. I guess physics detects the collision even if you destroy the object first. not sure if this counts as a bug. you have to disable collision each time the new object is spawned however. or maybe it's destroyed. if someone can clear that up for me, I'd appreciate it. I suppose some expirementation might shed some light, but if someone already knows, I'd prefer not to go through the trouble. Does disabling collisions only work for the life of an instance? so if I destroy all box2s does that mean that box1 won't have collisions disabled to it? or is it that if I destroy all box1s, it forgets disabled collisions? or does it only disable collisions for current instances that in the playing field at the time? etc etc etc....either way, you can't just disable the collisions in the start of layout event. thanks for the answers guys, I had forgotten about collisions altogether after my initial test until I read the replies

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