lIs there any AS 3.0 (or anything) tutorial on colliding non-circular shapes? I'm desperate, cause I cannot figure this one out. Nor google it. Nor find it via flash'kit search. I do not know how to make a correct inquery. It just throws circle collisons, or nonmoving rect+circ collisions, or car wall collisions. But I need a collision REACTION.
Say we have 2 rectangles. rect.A runs into rect.B back from side. How much should we rotate them? We know velocities, frictions, exact collision point, everything before the collision. But what to do next?
I'm probably not the first desperate trying to figure it out. But It's killing me! Whole week. I've been reinventing the bike for some 8 days now. Help? Anyone? Please?
I've encapsulated my game objects (space ships) in circle shaped energy field and do collision testing from there. Not so suitable workaround, but no other options around.
What you're talking about is called "rigid body dynamics". It's a branch of physics that describes the way rigid objects move (and collide) in space. It's the main feature of most game-related physics engines.
Chances are, you don't want to deal with all the math yourself - it's a pain. Fortunately for you, there are lots of fancy AS3 physics engines you can use for free. Google around a bit to find one you like. Then follow a tutorial to add it to your game.
Rigid body dynamics. Thanks's Nialsh. I just neeeded someone to shove me into right direction. Although I think I want to deal with that pain myself . I think it will be somehow less, than incorporating alien classes into my code. I will get lost sooner than in those math formulas.
Adamkyler - your creation is interesting indeed. I tried something similar when dealing with my problem. I imagined my rectangle as two balls springing to eachother at certain offset.
Forgot to mention, I have a little question, not worthy of starting a thread.
Say we have a movieClip, containing another 20 movieClips, while their .visible property is set to false - will they consume less memory,than when being visible? Cause in both cases they ARE PRESENT.
I've never seen a Flash program that allocated too much memory. Making things invisible can make improve speed because it reduces the rendering time. But I wouldn't worry about it - just write your code the easy way and if it ends up being a problem, you can always optimize later.
And this thread should be marked as solved. Googling "rigid body reactions" does the trick. There are lots of formulae concerning distribution of mass, but nothing impossible.
I hope to cover this stupid mistake of mine with a greatness of my slowly upcoming flash game. Take care everyone.