Inaccurate Collision Detection with Screen Jitter

Just started using Construct 2? Post your questions here

Post » Mon Jun 22, 2015 3:22 pm

Using: Tileset Map, 16x16 Objects, Sprite: Scroll to and 8 Direction behavior

When Sprite collides against a Solid Object:
-Screen starts to jitter by one pixel like crazy
-Collision Polygon does not apply accurately. Sprite collides randomly at up to 3-4 pixels away from the actual collision point set. It also bounces back most of the time by one pixel.
-Sprite colliding left or right will not jitter, but make it move 3 times faster than normally along the solid objects edges towards the "Is in Touch|Set Angle Towards, Move Toward 1 Pixel. Move betwen angles"

checked alot of guides and videos, but no luck with fixing this
B
9
S
1
Posts: 13
Reputation: 581

Post » Mon Jun 22, 2015 4:57 pm

Mind sharing your capx, so we could take a look?

Sounds like collision-polygon-problems (Is the sprite animated?)

What does this mean?
"Is in Touch|Set Angle Towards, Move Toward 1 Pixel. Move betwen angles"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 22, 2015 6:10 pm

Ah sorry, ofcourse.
Ill make a simplified copy of the map screen because there is alot of stuff going on with the game already.
(remove space around www)
https:// w w w .dropbox.com/s/yz0u4jn2pco1tuj/The%20Game%20How%20to%20Solve.capx?dl=0
As you can see, there is nothing smooth about the collision
B
9
S
1
Posts: 13
Reputation: 581

Post » Mon Jun 22, 2015 6:37 pm

Your main issue is having the 8-direction behaviour and not using it..

You tell mapchar to move 1 pixel in the direction of touch, which it does, only to be pushed back by the 8-direction-behaviour..
so the jittering is the moving 1 pixel and being pushed back outside the solid..

The problem with the collision being "too high" is that it's not..
MapChar is setting it's angle, while characteranimations isn't, so mapchar is colliding (rotated), while characteranimations is still pinned to the center (not rotated), so it looks like CharacterAnimations is way off from the collission..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 22, 2015 6:55 pm

This capx shows a possible solution..

https://dl.dropboxusercontent.com/u/485 ... roved.capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 22, 2015 8:07 pm

I see. Awesome, thanx alot. Though with that solution the sprite gets stuck when colliding and not moving towards the touch anymore. Trying to figure it out now. I guess it has to be move towards touchxy and not at angle.
B
9
S
1
Posts: 13
Reputation: 581

Post » Wed Jun 24, 2015 7:31 pm

idk, i even tried with pathfinding, but couldnt make it work. and pathfinding is not pixel perfect so its useless here.
any idea how to make LittleStains example work so the character wont get stuck when hitting solids?

this works very easy with using the keyboard. but with "Is in Touch" seems so tricky..
B
9
S
1
Posts: 13
Reputation: 581

Post » Thu Jun 25, 2015 10:03 am

tomwei wrote:idk, i even tried with pathfinding, but couldnt make it work. and pathfinding is not pixel perfect so its useless here.
any idea how to make LittleStains example work so the character wont get stuck when hitting solids?

this works very easy with using the keyboard. but with "Is in Touch" seems so tricky..


It doesn't really get stuck..
You want to move in the direction of touch.x,touch.y, but if in that direction it is overlapping I make the player move back in the same tick..
Splitting up the x and y movement might end up more being what you would like..

Not perfect yet, but improved again:

https://dl.dropboxusercontent.com/u/485 ... ved-1.capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jun 25, 2015 12:15 pm

thanx man, so awesome! very greatful. ill try work with that for a couple of days again.
maybe c3 will make "basic" stuff like that easier to implement for noobs ;)
B
9
S
1
Posts: 13
Reputation: 581


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests