Results 1 to 3 of 3
September 8th, 2012, 06:25 AM #13Registered User
Collision Detection fails with AI cars..... :)
I am making a car parking game in flash and AS3 wherein I drive my car along with other AI traffic cars moving along a specified path using Guidelines.
I had used CDK for collision detection.
The collision detection works fine with few AI cars, but doesn't seems to be working as required for few AI cars.
When an AI car is moving on a path in a straight line it works fine.... but when the AI Car turns at 90 degress..... my car goes into the AI car (Overlapping) and it hits at the center of that AI car and then collision is Detected.... .....
I made a New path and used a new Sprite for AI car... but still the problem pursues....
any help would be greatly appreciated.....
September 8th, 2012, 08:15 AM #253Registered User
I'm no professional at this but I'm pretty sure I know what the issue is. When you rotate the car the coordinates of your movieclip rotate as well. 0,0 is normally the top left of your movieclip but if you rotate 90 degree clockwise then 0,0 is now the top right of your movieclip. You will probably need to have a separate rectangle defined and use that for your collision detection.
September 8th, 2012, 01:27 PM #33Registered User
All the AI cars that I am using in the game are positioned along the center.... i.e the co-ordinates of the sprites are center aligned...... The problem occurs with the AI car that comes from top left of road and rotates with 90 degrees after covering a certain distance.....