Feeds:
Posts
Comments

Archive for July, 2009

In a current Electrotank project we are making heavy use of hitTestObject and hitTestPoint. Everything we were doing worked great. Then we went to build an editor using the Flex Framework and realized that some of our hitTestPoint checks were inexplicably failing.

After a decent bit of trial and error and hunches we realized it was that the UI components are using scrollRect. I then tested various conditions of scrollRect with hitTest to see how it behaves. It turns out that it always plays nice except with hitTestPoint with the shape flag property set to true and only when the point lies beyond the scrollRect boundaries!

Maybe this is common knowledge. But it is the first time I’ve ever run across it and googling didn’t easily turn up information on the topic.

The following two beautiful artistic renderings show the results of hitTest when performed with an object, point without shape flag, and point with shape flag. It shows them in the +x and +y quadrant, and the +x and -y quadrant. It then repeats with a scrollRect applied.
No scrollRect


scrollRect applied:

Advertisements

Read Full Post »

This post is related to a post I made a few days ago titled Ball Bouncing off Line Calculation.

The code used to determine the collision reaction of a ball bouncing off of a line shown in the previous post is the same as the code required to do it in 3D! So, you can achieve a ball bouncing off of a plane. Or, when you add gravity plus a little damping on the floor you can have things rolling around.

This example was designed so the ball would hopefully roll for a long time without rolling off. But if the ball was going a little faster you’d see how it can bounce into the air a bit if it hits an incline fast. Anyway, just thought I’d share!

(marble madness anyone?)

Note: if it seems a little slow, it is probably the 5 other blogs on this page that are running more intense things.

click to view example

Read Full Post »