How do I push out solids on rotation (w/ Custom Movement)

Get help using Construct 2

Post » Wed Jun 14, 2017 1:56 pm

Image

I am using a rectangular car with CM used for both rotation and movement back/forth.
To make solids work, I use When overlapping ---> push out solids to the nearest angle to make solid walls work.

Here are the main problems :
  1. When rotating, the wall pushes the car very rapidly along the side of the wall. I would very much like it not to happen and its currently ruining the game for me.
  2. Also, when you collide with a wall under particular angles it gives you a speed boost, which is retarded.

Note : Opposite angle unusable because it allows for no sliding along the walls + it sometimes throws the car miles away to a different part of the wall.
B
6
S
3
Posts: 104
Reputation: 1,596

Post » Wed Jun 14, 2017 7:02 pm

The push out action isn't very robust as you have seen, and beyond that the customMovement behavior isn't very useful at all in my opinion. So personally I'd not use any of the behaviors and just use events. This opens up all sorts of options of how your movement will work.

As an example here is maybe a starting point:
https://www.dropbox.com/s/gip5mebbb2fsh ... .capx?dl=1
The collisions are handled by moving or rotating and undoing that if it overlaps a wall.

A second iteration could make it use "dt" of smaller steps than 1 for smoother motion acceleration. Also instead of just moving to the last non-overlapping position you could instead just move the car till it's just not overlapping. In other words a function to push out of an object in a direction.

A third would implement wall sliding or basically a better push out closest function. With two boxes you could try pushing out the four sides of each, something like this:
https://www.dropbox.com/s/prhvpv4v559r8 ... .capx?dl=1
Probably not just like that as the new object picking may bite you in the foot. You can also exchange the loops of overlap checks with math to calculate the end position if you wish to delve into that. The SAT algorithm is helpful there.
Multiple wall boxes would just take a loop to do one box pair at a time. That is where the new object picking will become a nuance if you use the above method as is.

Maybe that may give some ideas. Not sure if it's super helpful as it's fully fleshed out.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959


Return to How do I....?

Who is online

Users browsing this forum: Solomon and 10 guests