ActionScript 2.0 :: Math-based Collision Prediction

Jul 21, 2004

For the physics engine I'm developing, (Flash MX) I need it to be able to handle particles moving quickly enough that hitTest() would be impractical because of clipping issues. I'm representing particle movement through vectors, and in each frame I update the position of particles based on their physics vector. I'm trying to design a collision detection system that detects whether the line representing the particle's vector intersects a movie clip, and where on that line it does.This way, I can figure out exactly if and where a particle will collide on the next frame without having to worry about it clipping. Problem is, I can't exactly tell the engine to parse every point along the line and check for collisions using hitTest; that would be too processor-intensive and would kill my framerate (I'm shooting for 24 or 30 fps.) Any good ways to tell if a line intersects an irregularly-shaped movie clip on the fly?

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Math To Get Width Based On Z-axis Change?

Oct 14, 2009

Does anyone know the formula to determine what the width of a Sprite would be based on changes to the z-axis?  I know the width property is updated after the change, I'm hoping to know what the width will be pre-change.

View 1 Replies

ActionScript 2.0 :: Collision Detection To Be Based On Movieclips?

Dec 2, 2002

Next I'm going to make a game with ball physics on it so if anyone can tell me how to make ball physics with bouncing from angled objects.Also, I need the collision detection to be based on movieclips because I need to be able to modify the levels in the game.

View 14 Replies

Flash :: Collision Detection In A Tile Based Enviroment?

Feb 11, 2010

I am having problems with my collision detection. basically when I hit a solid tile my character's body is half way in the tile already. here is my code.The properties wY and wX are my game world positioning. Not the stage positioning. dx and dy is the velocity the character is traveling. This first snippet of code is within a game loop. The focus point of my character is centered on the x axis

package com.objects
{
import flash.display.MovieClip;

[code].....

View 4 Replies

ActionScript 3 :: Flash - Math.floor Acting Like Math.round?

Mar 7, 2011

Here is the problem:

var p:int = 0;
var n:Number = 0;
n = 32.999999999999999;
p = Math.floor(n);
trace(p); // returns 33
n = 32.11111111111111;
p = Math.floor(n);
trace(p); // returns 32

I would expect both of these to return 32. I have searched, and it seems this is an unreported bug in AS3. Or ... am I doing something wrong?

View 4 Replies

ActionScript 2.0 :: What Is The Diffrence Between Math.floor And Math.round

Sep 26, 2005

Wat is the diffrence between these two?

View 2 Replies

ActionScript 2.0 :: [F8] Math.round And Math.ceil?

Feb 16, 2009

I have a code in which I have to use Math.round if a certain value is for example 3.67 (67 is higher than 50) and Math.ceil if a value is for example 3.23 (23 is lower than 50). What can I do to make flash calculate if what after the dot �.� in 3.23 (for example) is higher than 50?

View 2 Replies

Collision Detection Incorrectly Detecting Collision?

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

ActionScript 2.0 :: Math.min And Math.max?

Jan 16, 2004

So here is a piece of code that I have seen used a lot but don't really quite understand:

myVar = Math.min(Math.max(myVar, this.min), this.max);

or some variation thereof. I understand that the function first finds the maximum value of two values then turns around and uses that to find the minimum between two values.why this is done? And how do you know when to use it?

View 3 Replies

ActionScript 2.0 :: Math.min And Math.max

Jan 16, 2004

So here is a piece of code that I have seen used a lot but don't really quite understand:[code]or some variation thereof. I understand that the function first finds the maximum value of two values then turns around and uses that to find the minimum between two values.And how do you know when to use it?

View 3 Replies

Flash :: Web Based Visual Programming Interface Based On Python For Data Visualization

Nov 4, 2011

I just discovered impure.com and was very impressed by what can be achieved in terms of visualizing data using their workspace. Although the platform is free to use, but not open source yet. This causes a few problems because the API section works with .com sites for eg. for ebay, so I cannot visualize ebay listings for regional sites such as ebay.in because the link to ebay.com is hardcoded.I searched around, but didn't find other projects that offer a similar way to work with site APIs and other data sources with the kind of user interface and detail that impure.com does in a realtime way within a browser window.This brings me to the questions:

-What technologies would be involved in creating a similar kind of project

-What are the open source tools that can help develop a fullscreen UI to render the workspace. Are there any alternatives to flash for this, and how do they compare

The goal would be to use standard python data structures, python scripts to do some processing on these data structures, scripts to gather data from csv, json and API sources such as google yahoo, wikipedia and flickr, and scripts to render graphs, tag clouds, network visualizations etc. Then bring them all together into a visual interface that supports drag drop and simple type checking.How would the python backend integrate with the UI.

View 1 Replies

ActionScript 3.0 :: Tile Based Game - Creating Multiple Sprites Based On Frames

Nov 17, 2009

I'm relatively new to AS3. There's one thing that I don't quite understand about Sprites. I'm making a tile based game, and all the tile graphics for a level are inside one movie clip in each frame. Would I be able to go about creating multiple sprites based on the frames in said movieclip's timeline I would I have to go through and make a separate library graphic for each.

View 2 Replies

Flash :: Event Based Based Video Player?

Jul 15, 2010

I need a flash based video player that is able to trigger events I can listen to via JavaScript. The events I need to listen to are:

The play button is pressed The pause button is pressed The video stops (is finished)

View 1 Replies

Media Server :: RTMP Based HTTP DVR Functionality And HLS Based IOS Functionality?

Jan 20, 2012

I want to use RTMP based HTTP DVR functionality and HLS based IOS functionality, So I need to know how to MPP from my existing DVR app to the livepkgr app so that the stream being recorded at the DVR app can be used by the Flash and Stream MPP over to livepkgr app and can be used by the IOS HLS.

View 1 Replies

ActionScript 3.0 :: Math Differences On PC And Mac

Jun 27, 2011

I have created a flash 3d racing game which relies heavily on AS3's Math functions (sin, cos, tan, asin, acos, atan). It also makes heavy use of Matrix3D and Vector3D functions. The game works great on a PC, but the cars flip around and display innacurate positions on Mac computers. I know this is an issue due to the note on the Math docs page: [URL]

which states: "Note: The Math functions acos, asin, atan, atan2, cos, exp, log, pow, sin, and sqrt may result in slightly different values depending on the algorithms used by the CPU or operating system. Flash runtimes call on the CPU (or operating system if the CPU doesn't support floating point calculations) when performing the calculations for the listed functions, and results have shown slight variations depending upon the CPU or operating system in use."

how do I get this game to work on a Mac? I've tried using lookup tables and inline FastMath style approximations. But lookup tables still create the same problem, and the inline approximations I have found are not accurate enough for my game. I've also tried rounding values with floating point errors, but that has not seemed to help (in my implementation) either. I think the specific problem is with the use of Math.atan. I have not found an accurate approximation for this.. but I maybe that is not even necessary.

View 2 Replies

ActionScript 1/2 :: Math.random() Between 0.8 And 1.2?

Aug 23, 2011

How do I get a random number between 0.8 and 1.2 using Math.random(); ? It would be nice if you explain.

View 1 Replies

ActionScript 2.0 :: What Is Math.round() Do

Apr 29, 2010

What is math.round() do? In kirupa's Random numbers tutorial, he explained the use of math.floor(), but said round() was for another time. Yet I see that, and not .floor() in use in the random movement tutorial.

View 1 Replies

ActionScript 3.0 :: Math Libraries For It?

Mar 4, 2011

Are there any math libraries for as3?

I need primarily statistics and regression formulas.

View 0 Replies

ActionScript 2.0 :: Math.exp() - Undefined

Feb 1, 2006

[Code]....

why is it undefined?

View 4 Replies

ActionScript 2.0 :: Math, Ratios Between +/-'s?

Apr 24, 2003

here's where all you math genius' get to help me out. I know that this principal is not difficult and was taught sometime during my highschool years.I need a math formula which reduces the ratio of any x:y to the smallest quanity possible. Basicaly so that the smaller of the two numbers is 1 and the other number is whatever it would be, compared to 1... but, I need it to work for both posative and negative numbers.(I'm the ultimate Math newb.. bear with me)

so. I have x=20, y=20 is 1:1
-20, y=-10 is -2:-1
x=10, y=-5 is 2:-1
ect.

so what is the formula for that?

View 14 Replies

ActionScript 3.0 :: Math For Smooth Scrolling

Jun 12, 2009

Envrironment: Flash CS3, AS3 I have a horizontal image scrolling project that I am working on, and it works but is not super smooth, I would like it to be smoother when it scrolls, and realize that this is a function of pixels scrolled over time and the FPS of the document.

Right now I am moving the items 1 pixel at a time on a timer with delay of 8 to get it to scroll at the speed I want. I am moving it at 1 pixel in order to catch exactly when an object should wraparound to the beginning of the scroller to show up again. So I don't know that I can really change the number of pixels moved to more than 1 and still have the images spaced perfectly, which makes me think I need to increase or decrease the FPS and or the timer delay to make it scroll smoother. Right now it is at 30FPS and as mentioned the timer delay is 8. Small changes to the delay is not a problem.

This is one aspect of flash i don't fully understand. I would really like to know how to figure this out so I can apply it to future projects as well without doing trial and error to make it smooth. Can it be function, like a way to figure out I need to move a 120pixel picture 60 pixels in 2 seconds, what should my FPS be and the picture size and movement size and number of seconds can be variables?

View 7 Replies

ActionScript 3.0 :: Math For Rotated Dragging?

Aug 17, 2010

this math isn't working well. I'm using it for a rotated drag and drop (of a tone arm on a vinyl, a kind of abstract turntable simulation). Right now it just moves a bit in the middle of the vinyl (values between 21 and 36, is this degree or what unit is this?), but it should move between the two edges. The problem is that I don't know enough about trigonometry functions. Therefore I can't optimize the math for envisaged behaviour. Does anybody have an idea/tip how I can get a bit more control on the math and its effect? (maybe with more trace functions)

[Code]...

View 1 Replies

ActionScript 3.0 :: Using TextField Content For Math

Jan 12, 2009

Set variable as numbers
var monthly_num:Number = 0;
var ttl_num:Number = 0;
var ttl_rev_num:Number = 0;
// user-entered numbers from an Input textfields
monthly_num = monthly_txt.text;
ttl_num = ttl_txt.text;
// Multiply two user-entered number together to get new result
ttl_rev_num = ttl_num*monthly_num;

Attempts to assign numbers typed into textfields to numeric variables causes errors.
1067: Implicit coercion of a value of type String to an unrelated type Number.

View 1 Replies

ActionScript 3.0 :: Math Formula Conversion?

Jun 21, 2011

I'm not that good with Math and i have a formula for a that it's universal from what i understood but i dont know how to transform it to work with Flash's Math API. 

View 2 Replies

Actionscript 3 :: Math - Random Numbers Between Max And Min?

Apr 18, 2010

I'm generating a random number between min and max with this code:return min + (max - min) * Math.random();And it works. However, the random numbers are very little usually between "1 or 3" even if the max is 80.

View 3 Replies

Javascript :: GPU Accelerated Math In The Browser?

May 17, 2011

I'm starting a project for browsers which requires some complex data processing. The algorithm I'm using is 50-100x faster when accelerated with GPU.

I could use JavaScript, Flash or other technologies with the browser.Is there any way I can access the GPU to accelerate the processing of my math?

View 3 Replies

Flash :: Math - Fast Arithmetic Using The 3d Api?

Jun 3, 2011

Some computationally intensive software are now using the GPU to solve mathematical problems. Now that flash has GPU support, is it possible to use flash to crunch math problems? How would it be done. In other words, does flash expose sufficient low level API to control the behavior of the GPU sufficiently to perform such a task? Example of problems; Find a message with the following hash: 2987432847298374298374982374

View 2 Replies

Flex :: Actionscript 3 - How To Use Math Mod Function

Aug 25, 2011

How to use math mod function in flex?

calculate like this 7 mod(%) 2 = 1

View 1 Replies

Flash :: The Math Class Does Not Appear To Exist?

Dec 11, 2011

I think I broke my Flash. I'm using Flash CS5.5, and when I use AS3, any references to the Math class give me errors like this:1061: Call to a possibly undefined method sqrt through a reference with static type Class.1061: Call to a possibly undefined method pow through a reference with static type Class.1061: Call to a possibly undefined method pow through a reference with static type Class.The code in error is this:var dist:Number = Math.sqrt(Math.pow(initPos.x - pos.x, 2) + Math.pow(initPos.y - pos.y, 2));What the heck is going on here? Math is a top-level class, so I don't think I should be getting an error like this. Is it possible to somehow "break" the Math class? If so, how do I fix it?

View 1 Replies

ActionScript 3.0 :: Math Random - Getting Number Between 10 And 70?

Jul 8, 2009

I don't get it. I know it's Math.random(), but how do U use it. Let's say I want a number between 10 and 70.

View 4 Replies







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