0 Favourites

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

• 2 posts
• 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 :

• 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.
• 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.

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

Construct 3 users don't see these ads
• 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.

• 2 posts