Solved

polygonal shape collision detection

Posted on 2006-04-07
325 Views
Hi All,

I got a road movie clip,
and there are many movie clips  (abstackles on the road)

there ara different shapes movieclips on the background, (trees, stones etc ... these are stable)  (1.layer)
I added 2.layer, and put the small rectangular movie clip (piece) in order to check the collision

I got this code to check the collision,

and as the pieces movieclips increses it runs slowly

------------------
for (piece in _root.road) {
speed = 0;
car_hit = true;
break;
}
}
-----------------

Is there easier way?
Can we check the collisions polygonal shapes?

thanks,
Nurbek
0
Question by:nurbek

LVL 34

Accepted Solution

You can calculate the hitTest at pixel level in Flash 8, using BitmapData.hitTest

here is a sample with source FIle
http://www.gskinner.com/blog/archives/2005/08/flash_8_shape_b.html

I feel this is what you want...

: - Aneesh
0

LVL 13

Author Comment

thanks for giving the link,

It works, but it also slows down, uses more memory,

I solved it using my code, I splitted the movieclip into small parts, as the car moves it gets the name of the movieclips(road) that the car over on it ,

and loop inside only that movie, (before I was looping through all movieclips)

regards,
0

Write Comment

Please enter a first name

Please enter a last name

We will never share this with anyone.

Featured Post

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!