For the physics behavior you can do a custom gravity angle by applying a force at an angle to the balloon every tick. This is by far the simplest to do.

The motion bit isn't hard you could even do it without behaviors with two variables VelocityX and velocityY and an event like:

- Code: Select all
`Every tick:`

---add acceleration*dt*cos(degrees-90) to velocityX

---add acceleration*dt*sin(degrees-90) to velocityY

--- ball set position to (self.x+velocityX*dt, self.y+velocityY*dt)

The collision response with wall sliding is trickier. I'd recommend the custom movement behavior with the "push out nearest" action but I doesn't look right imo. But pushing out the closest direction is what is required for sliding, well that and making the speed in direction of the wall zero. For that you'd need two pieces of info: collision normal and overlap depth.

They possibly could be found with a bunch of is overlapping at offsets to find where around the ball is free and from that get the normal, then a few more overlap checks to get the overlap depth or just to push the ball out of the solid at an angle. With 3000 collision counts per second that would be 50 per frame at 60fps. You possibly could get it to work with using overlap checks in events but it would be tricky. If all your walls are only rectangles you'd only need to check 4 directions (wall.angle, wall.angle+90, wall.angle+180 and wall.angle-90).

Here is a capx of that idea:

https://dl.dropboxusercontent.com/u/542 ... nPush.capxNotice it's a bit jittery so it may need some more finesse. Maybe a sub event of 10 to backup into the wall by smaller steps than a pixel. As it stands I get about 10 collision checks per tick. Also pushing out at the corners of walls will be jumpy.

A superior method is in slide3.capx in this post:

viewtopic.php?f=147&t=103339&p=775018&hilit=wall+sliding#p775018It does one overlap check per wall and then calculates the closest direction and how far exactly to push out. The con is its much more complicated to make. Also a bench would have to be done to see if it is actually fast or if the extra calculations counteract.

But again the physics behavior is the easiest to work with.