ActionScript 3.0 :: Collision - Sweep Tests For Fast Moving Objects

Feb 7, 2010

has anyone found an AS3 source/Maths-lib etc that covers not just simple collision tests but swept collision tests (at least swept AABB/circle tests) for fast moving objects? I had a quick look at flixel but even that does not seem to have sweep tests for fast moving objects.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: HitTest Fast Moving Objects?

Aug 26, 2009

I'm just curious how you'd hitTestObject a fast moving object? The problem I'm having is that my bullet seems to skip over large areas depending on the speed. Since the speed of my bullet is 40 pixels per millisecond (I think), it seems to only appear on the stage in instances that are 40 pixels apart, so I cannot hitTest in between those instances.

Here's an image of the bullet patturn as I hold down the shoot button. It just looks like this, unchanging. I won't be able to hit the yellow object ever.

View 2 Replies

ActionScript 3.0 :: Collision With Moving Objects?

Jan 16, 2012

I'm having a little problem with collision detection. I'm currently with very simple game, where the only thing that is off is the collision.I tried with hittestobject and (as I found) it checks for the outer layer (my objects are a circle, and a weird star), so this method was of no use to me. Then I tried with hittestpoint, and I found that it checks for the center of the objects, so game over happens only where the center of an enemy touch the center of my character.I know that I must have something missing and I found a lot of guides but all of them were with squares or with static objects

View 3 Replies

Flex :: Detection And Moving Objects After Collision?

May 10, 2011

I am creating a scheduling application that shows projects (wrapped within a canvas) on a 2 week calendar timeline.If the user decides to move a project over by a day, i need to check and see if the moving project would then overlap with any other existing projects. If it does, one of the two projects would need to move down the screen along the y axis until the two projects no longer overlap.I've created a function that loops through a repeater item which is used to create the projects... the end result of this function is an arrayCollection that holds:

0. the id number within the repeater

1. the project title

2. x coordinate

3. y coordinate

4. the width of the project

5. the height of the project

I have also created a function that takes the two objects within the array collection and determines if they're overlapping.I can not, however, figure out a working loop that goes through the array collection, compares each item within it, checks to see if they overlap, moves the project if they do overlap, and then continues onto the next project.

Also, I need to make sure that moving one project will not make it overlap with another.I ended up having to reset each elements y value to 0 each time any project is moved and then re-evaluating whether or not they collide.

View 1 Replies

Professional :: Fast Moving Objects Get "cropped"?

May 22, 2010

I have got this annoying problem with Flash. Whenever I tween an object fast across the screen the part which points to the direction of the movement of the object gets cropped. Here is an example.The circle is moving across the screen roughly 3 times every second and as you can see, the front has magically disappeared for some reason. Same thing happens for objects moving slower aswell but the cropped off part is smaller. I could not printscreen this as the screen pauses on the current frame when you do that so that is why I used an external camera.

View 7 Replies

Photos Are Moving Too Fast?

May 12, 2009

I have an scrolling number of photos moving from left to right controlled by:

[Code]...

View 1 Replies

ActionScript 3.0 :: No Collision When Cursor Not Moving?

Mar 28, 2011

With AS3 I managed to resolve the problem I said in the thread, but now I face a new problem.If you hit the wall, it will register a collision as it should. Goes the same for the exit. But if you look to the upper left, there's a rotating rectangle. If you hit the rotating rectangle, it will register a collision IF YOUR CURSOR MOVED.That's right, if you freeze the cursor in place as the rectangle comes sweeping in, it WILL NOT register a collision, meaning if it were a maze game, people could cheat by just staying still.I forgot, here's the code:

Code:
stop();
stage.addEventListener(MouseEvent.MOUSE_MOVE, detectHits);

[code]......

View 2 Replies

ActionScript 2.0 :: CS3 Collision Of A Moving And A Static Object?

Jan 2, 2010

I have three objects in the main scene (so far), one of them is draggable (up and down only), then the animated one that moves downwards and the start button (activates the animation). So I've been trying to figure out how to script the collision detection for the first two? The collision should take place not because I dragged the slider onto the animated block, but because the falling piece hits the slider after I pressed the start button.

View 4 Replies

ActionScript 3.0 :: Stop Object From Moving Further When Collision Occurs?

Feb 22, 2010

As the title says: Stop object from moving further when collision occurs.

Right now I'm trying to make a sliding puzzle. So far I have a block which I can click and drag around, and a few walls which are the boundaries. What I'm trying to do is make an area where the block can slide within the boundaries. So when you try to drag the block into an direction it will stop, whether you got mouse_down or mouse_up. My script so far

Code:
stop();
//Sliding Blocks
MCBlock1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

[Code]....

Also I need to use a lot of boundaries, so if there's a way to apply this script easily to several objects

View 1 Replies

ActionScript 3 :: Ball Physics (Fast Move And Small Objects On Path)

Mar 31, 2012

After read a lot about ball physics, watch some examples and few days of trying making pinball with bitmaps, I use simple (easy to work with) and fast performance Physics AS3 engine for bitmaps [URL] but still cant fix problem: if ball is moving too fast and object on path is too small, there will be no collision detection (code works perfect only with bigger objects or if ball is moving slower). I am not good at physics and maths. Here is function code which make physics for ball on every frame rate (but maybe its better to change it to setTimeout):

function showFrame(e:Event) // onEnterFrame{
var collisions:Array = collisionlist.checkCollisions();
if(collisions.length) // if collision{
var collision:Object = collisions[0]; // get collision information
var angle:Number = collision.angle; // get collision angle
[Code] .....

View 2 Replies

Actionscript 3 :: Box To Circle Collision - Continue Moving And Never Collide When Swapping Values Around

Feb 24, 2012

I'm trying to implement a aabb to circle collision.

[Code]...

Somehow the collision does work as expected. Either they never move at all and "collided" was traced, or they'll continue moving and never collide when I tried swapping values around. Is there something i'm missing in my logic??? My box-box and circle-circle collision are working fine.

View 2 Replies

ActionScript 3.0 :: Too Many Objects For Collision Detection?

Sep 16, 2009

I have Object "A" that moves around and collides with other objects. There are hundreds of other different objects it can collide with. The only way (I found) to test for collision is to loop through every other object. That seems rather inefficient considering I don't even know how many objects exists. Other objects are constantly created and deleted. So this loop would be rather complicated.Is there a way for object A to receive what other object it collided with so that I can then do some code on that other object. Any way to avoid looping? I later need to find out how to detect what objects are near (within x pixels or so) of object A to decide with which one to interact. Maybe that could also be used now to limit the test of collision? Or maybe it gives someone an idea of what to try?

View 4 Replies

ActionScript 1/2 :: Collision Mask For Objects In A Game?

Sep 15, 2010

I'm starting with actionscript 2 and I can't figure out how I set a collision mask for enemies and characters. I've got birds that flap their wings but I only want the player to collide with the body, not with the wings, as they take up too much space and it would be unfair.
 
I tried mc.setMask and other things I found online, but somehow it didn't work, ie: did nothing. I think I don't get the way this works. I thought you'd need like an invisible rectangle that it checks collisions against instead of the actual animation.

View 11 Replies

ActionScript 3.0 :: Collision Detection - Falling Through Objects

Dec 27, 2010

[Code]...

I have a serious problem with Action Script. I'm about to code a new Jump&Run game with a simple gravitation Engine. And this is where I got my problem I can not solve! When moving the player through the levels, I want to move the layers instead of him. So the player stays somehow where he is but the enemies, ground, items ... move around - as in most of these games. The gravitation is intendet to affect every item/enemy (by ENTER_FRAME) and moves every object downwards until it hits the ground.

The problem is, objects of different Layers somehow don't get the right hitTest information. So when having two objects - the first on the same layer as the ground, moving both, everything is fine. But as soon as I put the object into a separate container like "itemsContainer:MovieClip" and I move that, the object doesn't get the right result for hitTestPoints. (Maybe it has something to do with localToGlobal??)

[Code]...

View 1 Replies

ActionScript 3.0 :: [CDK] Collision Handling Complex Objects?

Dec 29, 2011

I have been trying to fix my collision handling for hours now, but it seems like I am running in circles. To be blunt, my collision handling sucks. It is easy to break, and hardly works on complex objects(like water in my case, see the test at megaswf . com / serve / 1577272)

For collision detection I am using the collision detection kit, or CDK.My level is made up of different large MCs, such as a "wall" MC containing all of the smaller walls, such as water, a tree, or a wall. CDK allows me to hittest the single walls by hittesting the large one, and not each one individually, making it easier for myself.My code has a lot of repetition(8 directional movement), so I will put a "//..." to simplify.

Main.as:

ActionScript Code:
public class Main extends MovieClip[code]......

I have literally been working on this all day, and only feel like I'm making it worse every time I change something. You don't have to spoon-feed me code, the idea should be enough...

View 0 Replies

Actionscript 3.0 :: Collision Test With Multiple Objects

Dec 3, 2009

I'm having a problem with a hitTest that I'm not sure how to correct. Long story short, I have a box that is added to the stage and beings to tween down to the bottom. If the user presses the left arrow to catch the object before it leaves the stage, they get 1 point (hooray!).The issue that I'm having is this...multiple instances of the same MC are supposed to be added to the stage by a timer but because of how I've set it up, they all have the same instance name. That leaves me with one of 2 options. I can get the hit test to work, but only 1 instance ever actually shows up or a bunch show up, but the hitTest fails. How can i add multiple instances of the same object, but still be able to determine if one of them is overlapping the box when the user hits the arrow key?[code]

View 3 Replies

Actionscript 3.0 :: Collision Detection For Multiple Objects?

Jun 13, 2010

I want to detect collision for several different objects, but want to keep the code as short as possible. whether I can use an array to hold the different movieclips and then detect collision with the entire array, or if I have to create a class and do it that way.

View 1 Replies

ActionScript 2.0 :: Collision Detection With Duplicated Objects?

May 8, 2006

I'm making (or rather trying to make) a collision detection demonstration for my Media Studies coursework using a game as an example. However, I use FOR and duplicateMovieClip to create both a) the enemies and b) the bullets. how to register collisions with these objects.

Also, if anyone has any tips for using an array instead of the endlessly repeated "else if (x<num) {" lines, that'd be great to know!

For some reason I can't upload the ZIP file with the Flash in it on this Mac, but I'll upload it back on my own PC soonish. I'm not letting all this stuff I've typed out go to waste!

View 1 Replies

ActionScript 3.0 :: Flash Game - Making Collision Between 2 Objects

Mar 16, 2010

I am having a problem with my collision game. When I try to make collision between 2 objects, this occurs: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Level$iinit().

Here is my PHP Code:
package {
import flash.display.*;
import flash.events.Event;
import flash.geom.Point;
import flash.events.Event;
import flash.events.MouseEvent;
public class Level1 extends MovieClip {
[Code] .....
My flash file is at [URL].

View 1 Replies

Flash :: Collision Testing With Multiple Objects On Stage?

Nov 27, 2011

I'm trying to create a sort of tree diagram such that, if you click on one of the circles, its child circles spread outward with some degree of randomness from the original circle, connected by lines. I have this working, but now what I want to do is make sure that none of the circles collide with each other and none of the lines criss cross. You can see the screenshot for what is currently happening. My code is below. How do I change this code so that it checks for collisions and avoids them? I've read up on flash's hitTestObject command, but that only works in the context one object to another. I want to test for one object contacting any display object.

import com.greensock.TweenMax;
var sw = stage.stageWidth;
var sh = stage.stageHeight;

[Code].....

View 2 Replies

ActionScript 3.0 :: Collision Detection For Array Objects In A For Loop?

Nov 13, 2009

a little while ago I saw something on this website:[URL]...I decided I wanted to recreate something like it.

They're using javascript, I'm using ActionScript, anyway.I'm trying to create collision detection for an array of movieclips inside a for loop. Right now I have it that upon holding down the mouse, the same movie clip will fall onto a ground object (and bounce up occasionally,) I'm trying to make it to so each ball could stand on top of each other. I've used collision detection before for separate objects, but never for instances of the same object inside a for loop.

View 0 Replies

ActionScript 3.0 :: Collision Detection, Stopping Objects From Going Through Eachother?

Jan 16, 2011

I'm running a HitTestPoint to detect when two of my mc's collide, but I don't want them to be able to go right through each other. Someone suggested I find the x,y coords of the moving object when the collision occurs, then update that mc's coords to this x,y each time a collision occurs. I've been Googling but came up empty. Below is my code

private function __checkHit($evt:Event):void {
if (this.coin_mc.hitTestObject(target)) {
if (!hitting) {[code].....

View 2 Replies

ActionScript 3.0 :: Fail Hittest Collision Using Multiple Arraylist Objects

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

ActionScript 3.0 :: Managing Multiple Collision Detection Between Objects (not Necessarily Circles)

Jun 20, 2011

a way, to manage a multiple collision detection with pixel level detection, for objects, not necessarily circles, irregular objects.

View 5 Replies

Drag And Drop Multiple Objects And On Collision Activate/play A Video Clip

Jun 7, 2010

I would like to drag and drop multiple objects and on collision activate/play a video clip.

View 3 Replies

ActionScript 2.0 :: [CS3] HitTest On Moving Objects?

Jan 22, 2009

I'm making a game where a character moves around a level and stays in the centre of the screen as the background scrolls past. I have created a movie clip of an enemy that moves up and down, and used hitTest to stop my character flying through the enemy and also to deduct a point from the score. However, if my character hits the enemy and stays underneath him, the enemy's movement pushes my character out of the screen, and you can no longer see him.

View 3 Replies

Professional :: Objects Moving 360 Degrees?

Feb 1, 2010

i'm not quite sure which forum to use, so therefore I post this discussion here. I want to animate an object that is turning 360 degrees around.

[Code]...
 
It does'nt need any navigation like this example, but it's going to just an animationmovie.This animation is going to be viewed on a widescreen tv. How do I make the animation fit the screen? I'm not sure which resolution the animation must be. I guess this has to match the resolution of the tv. But is it just as simple as changing the flash file settings in 1920 x 1080?

View 6 Replies

ActionScript 3.0 :: Two Objects Moving Around With Mouse?

Nov 25, 2011

I'm making a catching game and I only wanted the falling objects hit certain area on my catcher. My catcher is a girl with mouth open and I wanted the falling objects to hit only the mouth, not any other parts of her body like arms. So I made two objects, the full girl and just the mouth. How do I make the two objects (movieclips) move around with the mouse?I tried to embed one object into another but it didn't work....

This is actionscript I wrote so far:
package {
import flash.display.*;

[code].....

View 6 Replies

Flash :: Moving 2d Objects On A 3d Plane?

Jun 11, 2010

I have a 2d plane rotated on its x axis, with 2d display objects I want to move around on the plane. Its pretty similar to a chess board [URL]..

The board is a rotated rectangle, and the pieces are just 2d display objects. Whats the easiest way to manipulate those objects so they appear to be moving on the board?

View 1 Replies

Flash :: Moving Objects With Timer?

Sep 1, 2010

I have this class named MovingObject which extends the MovieClip class. This class will be instantianted for several times. Inside this class is a Timer that handles the speed of the objects moving. There is another class called TheStage and this is where I will instantiate MovingObject (s).

public class MovingObject extends MovieClip{
public var tmr:Timer = new Timer(1);
public function MovingObject(){

[Code].....

Assuming that the code is working fine (I haven't debugged it), this makes the particles to move all at once. However after several seconds of running it, the particles seem not to be moving in synchronization with each other (because their distances between seem to get nearer).

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved