• entries
    743
  • comments
    1924
  • views
    580451

Squishy updates

Sign in to follow this  

73 views



Minor cosmetic change - Squishy now frowns slightly and the direction of the angle of the blink is reversed. It is a minor detail but it gives him a lot more character in my view. My avatar is updated too. [smile]

I've more been working on ways to prevent Squishy getting stuck in deformed states. The way I've approached it is to check every frame to see if the dot product of the vectors formed between each set of three outer circles is above a certain threshold.

Initially it seemed that simple, and Squishy was bursting under these circumstances but I then found he could get destroyed by crashing into sharp corners as well, so I've built in a timing system. If Squishy fails the above dot product test for more than a quarter of a second, he bursts, meaning very brief deforms caused by bouncing off sharp corners are okay.

This means I don't have to decrease his maximum speed, which was the other, less favourable solution.

I've also updated things so that sensor areas now send a 0 signal to their client when you leave them, as well as a 1 when you enter them. This proved a bit tricky as Box2D reports constant streams of multiple creation and destruction points when two shapes actually overlap rather than touch, so Squishy has to keep track of the number of contacts with a given shape, incrementing and decrementing as the create and destroy signals come in and triggering the 0 only when the contact count drops below 1.

Got there in the end though. This is more useful than it probably sounds but I'm too tired to talk about it at the moment.
Sign in to follow this  


1 Comment


Recommended Comments

That's very cool that you can test for when two shapes stop overlapping. I remember reading requests for "negative shapes" on the box2d forums so that people didn't have to circle an area with rectangles to know when a body left the area. I never thought to count the contact points. Although, if a body is created inside the said sensor, no initial contacts are reported because box2d only reports when shapes collide from the outside... So I'm not sure that would be very convenient for large sensors.

btw, your Tab2Space program is very handy! I had the same problem as mentioned: sometimes the clipboard gets erased. But I found that it only happens when I copy more than about 25 lines. I used it for my last post but had to copy 20 lines at a time! If you'd fix the limitation I'd appreciate it very much!

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now