(This is difficult to show, since the FPS of GIFs isn’t very high.) If you look at this closely, you can see that the rotating object sometimes “snaps” to the ground. Then the object turns, it sometimes doesn’t do it perfectly and a small gap emerges between it and ground. The object seems to – arbitrarily – “snap” back into it. The places where this happens however, are consistent. There’s also a small flash that doesn’t appear in the GIF. I think the object disappears for one frame, but I can’t really tell.
My assumption is that this has something to do with rendering… with half a pixels or something…
INFO:
Object size: 32x32
Ground size: 128x32 (ground made out of a tilemap)
Game resolution: 640x360 (in project properties)
Game resolution via events: 1920x1080) (In the beginning of the scene I change resolution to this)
My (physical) computer screen size: 1920x1080 (I play in fullscreen)
Camera Zoom set to 2
Glitch number 2:
This purple object has ellipse movement. Like this:
It just doesn’t look like it because it’s stuck under a block like that.
The problem is that it gets stuck in some specific places. Very strange. The levels are made out of a tilemap, so there really shouldn’t be anything that could cause a collision. There’s nothing to bump into. It should slide cleanly.
I wouldn’t be surprised if these both had a same cause.
Thanks.
Edit 1:
Glitch number 1 happens even when camera zoom is set to 1.
I don’t known if you think like me but i think it is not very logic the instructions “If one…” and “If all…”
I had many problems with these and i was in the obligation to modify my evenements to fix that.
What puzzles me is that the gap exists for the top, bottom and right side, but not the left side of the platform. And it only exists while part of the block is off the platform. As soon as it’s completely on, the gap is closed. I can’t see why that is, but hope that observation may help.
Also, the events you’ve provided only show the collision into a platform. It doesn’t show how the object checks if it’s reached the end of the platform and is in the air.
It’s quite normal logic. It’s just saying “If (A and B) or (C and D)...”. A and B both need to be true at the same time, or C and D both need to be true at the same time.
This is Wrong with a capital W. I know because I end up doing stuff like this and then scold myself later on when I have to change something. I totally understand why in this situation it is easier, initially, to just duplicate the events. But it would be so much better to have a single event that handles turning around any corner. For the angles you could be adding and subtracting 90 degrees, instead of hard-coding the values. Comparing the corners is a bit more tricky, but definitely possible. Even if you don’t figure this out for this project, its something to think about going forward. You’re not going to lose any performance by doing a little bit of math, but you will gain a lot in terms of programming finesse and problem solving skills.
Now on to the actual problem
First of all, objects rotated at 90/180/270 degrees are not perfectly aligned with the X and Y axis. This is very annoying and I have reported it as a bug, which I think was ignored. In any case this is easily proven with basic collision tests, if you have two squares sitting right right next to each other but not colliding, then change one of their rotation to 90 degrees, they will suddenly collide.
The reason for this, I think, is that the object points get recalculated with a slight error. I’m not completely sure if it is the position that gets off, or the corners (i.e. the rotation isn’t perfect). I vaguely remember trying to reset the position back to integer values in order to combat this, and failing? But I’d have to verify that. Point is, I suspect your collisions are slightly off because of the rotation.
The second thing I suspect would be that you are using “Stop the object”, without making sure the position is exactly what you want. So for example if the box can move fast enough to go a little bit past the corner, then you’re going to end up stopping it when it is actually a little too far out. In this case you would need to “snap” the object back to the proper position.
Yes. I’ll deal with it eventually. I’m still a beginner
Alright
Yes. This happens. I just haven’t been able to figure out how to snap it back a correct amount in right direction. I’d expect there to be a small gap, but I don’t understand how the gap can - sometimes - suddenly disappear on it’s own.
Do you have any idea how I could try to fix the “glitch snap”? Also, do you have a better idea for locating ledges? The method I currently use will often leave a gap, as you correctly pointed out.
How about glitch number 2? Do you have an explanation for it?
Based on the info you provided, I tried adding this at the end on my Yellow Object Movement -behavior:
It seems like glitch number 1 is now completely gone :)))
My solution isn’t optimal. You could reason that I don’t need to round the coordinates every single frame. It’s only necessary to do it once every time Yellow object turns. However, it seems like this doesn’t work for whatever reason. Rounding every frame fixes everything.
So thank you very much Magicsofa.
I also have more info about the glitch number 2. It seems like I can change the position of the invisible bump (the bump that temporarily stops the Violet object from moving) by re-drawing the platform…
Could the way I draw the platform to the scene effect it’s actual shape?
Not really, especially if you have snap to grid enabled then it should come out the same every time. Unless some of them are already off the grid or being copied as such. I would select the platforms one at a time to look at the instance properties panel. If any of the X, Y, width, height, or rotation values are slightly off, then that could be the issue. When an object doesn’t fit exactly in the grid, snap to grid will only snap the corner or edge that you are dragging.
The green line shows (exaggeratedly) how the Purple object interacts with this platform. Basically, if you add a tile inside this rectangle-shaped platform, the tile on top of it “gets raised” and the tile under it gets “lowered”.
In this GIF which I posted earlier, the only places where multiple tiles are on the same column and touching are the very edges of the platform, which is why the purple object gets stuck there.
In this picture, where every column of the platform has multiple tiles touching each other, the Purple object can get stuck between any 2 tiles.
It seems like the Purple object can’t get stuck more than once in a single ellipse movement cycle. In a case similar to that in the last image, the Purple object only gets stuck between the first 2 tiles it comes across, and then cleanly slides through the rest before repeating it’s movement cycle.
Oh wow that’s an useful tool. I didn’t know about that. i just tried it. I saw nothing that could explain Glitch number 2. The collision box is as expected. (Using this event also makes my game lag really badly. I start to clip through stuff and even my solution for Glitch Number 1 stops working for some reason.)
I’ll send you guys a simplified version of my game in couple of hours. I probably should have done so earlier. You can examine the glitch number 2 more easily then.