why the shift (physics "set velocity" glitch)

For questions about using Classic.

Post » Thu Mar 26, 2009 8:05 pm

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
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Mar 29, 2009 6:23 pm

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:
[u:1jl2epfi]here[/u:1jl2epfi]

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.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Mar 29, 2009 8:01 pm

I have no idea why it's doing that.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Mar 29, 2009 9:04 pm

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.
B
2
S
2
G
4
Posts: 171
Reputation: 1,792

Post » Sun Mar 29, 2009 9:10 pm

[quote="dkdoom":3pmvnojw]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[/quote:3pmvnojw]

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 :/
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Mar 29, 2009 11:51 pm

SOLVED!:
[u:1atwjdxm]tada![/u:1atwjdxm]
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
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests