ActionScript 3.0 :: HitTest() Point Of Collision?
Dec 4, 2009
I've found the BitmapData.hitTest() function very handy, but limited for my purposes. I need to figure out at exactly which point the two images collide (in any coords system,really), since their behaviour will change depending on the angle of the surface hit
View 9 Replies
Similar Posts:
Apr 18, 2012
I'm trying to create an animated 'LED style' display. I want to draw/tween/type shapes or text and have the 'LED dots' detect the animation and turn on the relevant dots.'ve been testing the hittests but it slows down pretty quickly and the problem with the hitTestObject is that it obviously just detects the bounding box, NOT the vectors.
View 3 Replies
Apr 3, 2004
I'm try to make the Collision Detected with hitTest for long time but it doesn't work. I have two objecct one is the Spaceship and rock. When those two hit each other. I want it to show text "Collision DetectedFrame1 script
var rockCount = 0;
var rockTimeGap = 1;
var nextRockTime = 0;
[code].....
View 3 Replies
Aug 26, 2010
I have two png files, a circle and a maze. Basically the maze is a square with some paths carved through it. I want to draw these images, move the circle to the mouse coordinates, and have a text say 'hit' when the circle intersects a wall of the maze and 'miss' when it doesn't. Now I want to do these using the bitmapdata.hittest method. The circle is a 32x32 image and the maze is a 256*256 image. I've gotten everything set up and everything draws on the screen correctly but I can't get the actual collision detection part of it to work, that is it always displays 'miss' rather than 'hit' even when the circle clearly intersects the maze.[code]
View 1 Replies
Apr 3, 2004
I'm try to make the Collision Detected with hitTest for long time but it doesn't work. I have two objecct one is the Spaceship and rock. When those two hit each other. I want it to show text "Collision Detected" This is my script
Frame1 script
var rockCount = 0;
var rockTimeGap = 1;
var nextRockTime = 0;
var startTime = getTimer();
[code]...
View 3 Replies
Apr 4, 2003
I can't seem to get hitTest to work for the plane in my little game. The code I'm using in the plane MC is:
[AS]if (_root.player.hitTest("_root.badguy"))
playerhealth -= 20;
}
[code]....
I want to the badguy plane to hit the player's plane and take a subtraction from the player's heath. I've fiddled around with using "this" instead of the full path of the playerMC - no success. My hitTest is working fine for the bullets!
View 3 Replies
Mar 10, 2006
For some reason my hitTest in the following function is not working. With each onEnterFrame of the mc being "fired", I am checking to see if it is touching one of the "clouds" I have floating by. My traces tell me that I am targeting everything correctly, but for some reason, hitTest never returns true. Even when I see the mcs colliding. The "clouds" are dynamically attached and pushed into an array (cloudsArr) The clouds and the "fire" mcs are on differnent timelines, but should that matter if I am targeting them correctly?
[Code]...
View 5 Replies
Dec 12, 2002
Does anyone know how to use hitTest with two movieclips so that it would detectthe collision of the visible part of the MC, not the **** bounding box???
View 2 Replies
Oct 13, 2005
Right now I'm working on an advanced hitTesting engine, and What I'm trying to do here is create an engine that will detect collision with one object instead of two. That basically means that if any other objects touch this movie clip, the hitTest will return True. Right now the .fla containing the engine has nothing but a circle that can be moved using arrow keys and 8 squares that disappear when touched by the circle. Obviously, I could do something like:
if (circle.hitTest(square1)) {
do so and so
} else if (circle.hitTest(square2)) {
do this and that
} etc...
But that would be too long, since the engine has to be able to contain 100 squares without too much change in the code.
View 3 Replies
Jan 4, 2011
I'm actually working on a multiple collision detection in actionscript 3.0, using pixel collision for a game for my assignment, where an enemy patrols around and searching for the hero. So, i draw a line between the enemy and the hero, to check whether there's some collision happened between those two. if the line colllides with an obstacle such as wall, door, etc. enemy will not be able to see the hero. When i tried a single line collision with a wall (one object only) it works perfectly.
But here's the problem. For the multiple objects collision (several walls and doors included), i added those objects in an arraylist, When i used for loop to check the collision between the line and those objects in the arraylist, none seems to react , except the first object in the arraylist or index 0.
Is there any simpler way to do the multiple collision detection?
View 2 Replies
Jun 14, 2010
Important: ActionScript 2.0Flash CS3I have some knowledge in Java and C++ which makes this easier... Im trying to make a game and the collision *** does not stop the character in its spot... if i set _y to 0 then it would go to the top of the screen... if i set _y to -1 each frame that the hitTest is active then the character goes through the platform and the rises by -1 (1 up) _y .... how can i make it so the character is stopped immediatly when touching (hitTest) the platform?
[CODE].....
View 6 Replies
Jun 25, 2008
Because I want to detect collision between a point and an MC contained within another MC.
View 1 Replies
Aug 30, 2009
I got a working broad phase and collision detection is fast enough.Now my collision response is working, but slow. I have trace(using getTimer()) through the whole resolving method, and I found the slow spot is where I get the collision point and normal vector.
Right now, I test each point on each shape against each line on the other shape. This works nice on triangles, but other shapes, it much to slow.I would think that using SAT(seperating axis therom) would have a way to get this when checking collisions, but I cant seem to get it.I need a fast way to get the collision point and normal vector.(Right now, it takes about 3 milliseconds per collison on a rectangle with 4 points and 4 lines)
View 0 Replies
Jul 7, 2010
I need to know what side of a rotated box my sphere/point is colliding with and at what angle.
I could perform the 4 lines check but I think it will be too cpu consuming. I need it for fast simple physics simulations(bounces)..
View 9 Replies
Dec 6, 2010
I want to check a hit test between a point and a png bitmap with an alpha channel. I know bitmaphittest is for 2 bitmaps. Hittest is for 2 bounding boxes and hittest point is for a point and shape, but it doesnt work with a alpha channeled bitmap. So what do I use to test a point against an alpha mapped bitmap?
View 6 Replies
Mar 4, 2011
I have a 3d projectile game I'm working on. I want to check if the projectile moving down the z axis hits wall on two sides. The walls are set up like this:
leftWall = new wall();
leftWall.x = 10;
leftWall.y = 360;
leftWall.z = 230;
leftWall.rotationY = -95;
How to do collision detection in this 3d space?
View 2 Replies
Jul 9, 2011
i'm breaking my head over something, and will be very grateful to any creative ideas:
I created kind of drag and drop game: i have cards that should be placed on squares.
in case the card touches any square, the square changes it's color. the problem occurs when the card touches 2 squares at their middle: they both change their color.
in fact, I need that only one of the square will change it's color, and it should be the square that the card touches it with "the most of him". i thought of using the hitpoint but i know it won't work, because in case the card touches both square in the middle it won't work..
View 2 Replies
Sep 1, 2011
how to use the bitmapData collision method. Now I'm trying to figure out if there is a way to see at what angle or coordinate of the bitmapData the collision happens? I need it in order to figure the accurate bounce angle after the collision occurs.
View 2 Replies
Oct 16, 2009
In my file (AS2), I have a small square at the middle of the page. Diagonally to the right, I have a vertical wall which is a rectangle. Pasted inside my small square, I have the code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (this.hitTest(Wall._x, Wall._y, false)) _x =
[code]......
View 1 Replies
Jan 15, 2009
i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).
View 1 Replies
Feb 8, 2010
i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
[code].....
View 1 Replies
Dec 9, 2011
Im pushing Point locations into an array to Shift em out later. like this:
tempmoves.push([new Point(roundx,roundy)]);
..
ob.movestoplayer = tempmoves;[code]....
What am i doing wrong?
View 8 Replies
Apr 12, 2007
It's been a long time since I've done any work with actionscript, and alas I've forgotten nearly everything. I've tried to look for a tutorial that would explain basic animation with actionscript, but the one that I found on Kirupa was no longer there.
Basically I'd like to do this:On the stage I have a movieclip and I'd like the movieclip to move along the x-axis to a certain point and then back to the starting point again. The moving speed of the movieclip should also be adjustable.
View 8 Replies
Feb 8, 2009
I'm creating a game in flash for a university project, and learning actionscript and programming as I go. I'm very much still at a beginner level - at the moment al I have is some actionscript for drawing rectangles and moving them about the screen. This is what I'm having trouble with at the moment: I have a class called 'Creature', and I want instances of it to interact with each other. I want them to do something when they come within a certain distance of another instance. And I want them to be able to pick a random other instance to get the location of, in order to do something with that information.
What I think I need is: A function for telling the distance between two (x,y) points.
A way of referencing the nearest other instance of the class. And a way of randomly selecting from all of the instances of the class.
View 4 Replies
Mar 27, 2011
How to convert 3d point to 2d point? I've found next formula in Internet(camera is situated in origin)
[Code]....
But these formulae give me strange result when z are less than zero(z<0) I need build line from A(100,100,100) to B (100,100;-100) As you can see these equations give really strange result when I try to convert B point in 2D dimension
View 1 Replies
Jul 15, 2011
i have the follow issue :
I have a point which is setted at the border on a component, with changed transform point to the center of a component in order to match the component rotation.
the important part is when i try to get the point XY after rotation - they remains the same as before rotation.
how to get XY, after rotation ( changeing point.rotation property to specific degrees of rotaion )
View 2 Replies
Aug 19, 2009
I am using AS2 with Flash 8 Professional So, my problem is that I currently have a man in the middle of the screen, who shoots a line towards the mouse when I click. However, when I use hitTest to see if the line collides with another object, Flash recognizes the line as a large box if it is diagonal, so the hitTest isn't very accurate. The line only satys there for one frame, so I can't have the usual moving-bullet-style. I am either looking for a way to create an imaginary line with AS from the starting point to the mouse and beyond, and tell whether or not this line intersects with an object... or some other way that I haven't thought of to fix my problem. Keep in mind that the line rotates from a center point towards anywhere around it for 360 degrees.
View 1 Replies
Aug 20, 2009
if i have a movieclip or a sprite could i find (via code) where is its registration point compared to its top left point (no rotation included) ?
View 4 Replies
Apr 27, 2004
my preloader bar isn't growing smoothly. it appears to jump from point to point -- and i want to make it smooth. you can see the example here at: [URL] would anyone mind taking a quick look at the file i've attached,
View 6 Replies
Feb 19, 2005
I know some basic trig. but how do i find an angle from an anchor point and a moving point?
adjecent = _root.anchor._x-_root._xmouse;
opposite = _root.anchor._y-_root._ymouse;
hypotenuse = ((adjacent ^ 2)+(opposite ^ 2)) ^ 0.5;
View 2 Replies