ActionScript 3.0 :: Curved Surfaces - Find The Utmost Y Point Of The Ground At A Given X?
Oct 30, 2009
So I have a ground that's supposed to be, for the most part, curved. How can I find the utmost y point of the ground at a given x? The ground looks like so: The function I have right now sort-of works, but seems very inefficient. You input an x parameter, and the function loops using hitTestPoint with a constant x and a y that increases until it hits the ground. Then it returns that y value. Is there a better way to do this? This method seems like it would get slow.
View 4 Replies
Similar Posts:
Dec 2, 2007
Any way to get a curved line to draw from a known point a to a known point b. Point b will always be changing and will be in any position around point a. I can work with an existing line from a movieclip and change it somehow, but right now I can't find any way to accomplish it.
View 2 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
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
Mar 26, 2010
Do you have any recommendation for a free 3D charting library in Flex. To be more precise, I only need to draw surface (for now). Basically, I just need a chart that displays three axes (one should be timeline, and two should be linear axises) and the surface.
From what I have seen so far, two most popular free Flesh 3D libraries are Papervision3D and Away3D. Also, I've found one IBM library - ILOG Elixir that looks really nice, but it's proprietary (although, I haven't seen any surface examples for Elixir neither). From what I have seen, Papervision3D and Away3D should do much more then 3D charting, but I haven't seen any examples on how to draw surfaces in any of them (except this line chart in 3D: [URL]
View 1 Replies
Aug 26, 2010
i am trying to find center point of my pie.
var myTween:Tween = new Tween(piechart,"............", Strong.easeOut,1200, 510, 1, true);
i want to animate from the center and it has a xml driven data file.
View 2 Replies
May 22, 2010
I'm not a genius in geometry, I'd like to find a point in as3 with the radius and a angle but I don't remember the rule, I know this should be simple!
View 3 Replies
Nov 18, 2011
I am currently looking at a way of visualising data and a part of the algorithm needs something 99% the same as A* Path Finding but I cannot wrap my head round it fully. I know it will be a fairly simple modification. (specific cost instead of least cost)
Basically I need to plot a path (2D Grid, no Diagonals) from point A to point B in X number of steps.
E.g. If the start and end points were right next to each other and I needed the path to be 3 steps it would have a tiny loop. (moves: up, right, down). Is there a known name for this algorithm or is the use of this so rare it's uncommon? I am currently looking at this AS3 Librbay for modification as it is apparently very fast and seems clean and simple to me:[URL]..
View 3 Replies
Aug 8, 2009
I once needed to pan a sprite full of movieClips (picture 1) which were draggable with no bounds so you could drag them up and left (higher than sprites registration point).
You could also drag them down and right and expand a sprite that way (as well) but that didnt matter.What did matter was how much is 'up' and 'left' from the sprite registration point so i can include that in my formula for panning.
This was easy to find, i just sorted my array of movieClips, sorted on x and sorted on y after each drag, and thats how i got my up and left points.
Now I am trying to do that same thing, exept my movieclips inside a sprite have a custom rotation (picture 2), so i also have an up and left point, except this time up and left are caused by rotations of movieClips inside a sprite... (and these are dragable as well with no bounds)
View 1 Replies
Aug 22, 2009
To make this easy, lets say I have a movie clip with a diagonal line in it (top left to bottom right).
I want to start my y position at 0, and place it in a loop and increase y by 5 every time. So we start at the top left of the clip, and move to the bottom of the clip.
Now since we have our y value (0, 5, 10, etc.) would you get the x position of the line? such as (x, y):
5, 10
or
42, 15
View 1 Replies
Feb 14, 2011
How could I find the distance between a given point and a drawn line? I was thinking about using the point-slope formula to draw a perpendicular line between the point and the line and measuring it as the distance, but I'm not quite sure how to do this in as3.
View 0 Replies
Sep 18, 2011
Given this grid (tinyurl.com/63dgoja --> This is a trapezium/trapezoid, not a square), how do you find the point clicked by the user? I.e. When the user clicks a point in the grid, it should return the coordinates like A1 or D5.
View 2 Replies
Apr 13, 2006
I am looking for a way to find a vector if I know one point and 1 angle. Like I have A(x, y) and a vector starting from A(x, y) with an angle. I would like to know the position on a point X (x, y) that can be anywhere on that vector. I only know the coordinates of A and the angle. Possible?? I guess it has to be a function...
View 5 Replies
Jul 9, 2007
i'm triying to make a dinamic generated plane, that plane has a grid with lines in X and Y, by now i'm able to generate a grid clicking and dragging points to make 4 lines and i generated 2 lines between the midles of the opposites lines like this:
[Code]...
View 1 Replies
Apr 19, 2011
i want to find third Point of Triangle i Have two point p1,p2 with respect to it i want to find third point of triangle
Note one thing triangle is 45 - 90 - 45 degree so the point i want to find is at 90 degree,
so as per my requirment p1 = 45 degree p2 = -45 degree and p3 = 90 degree so i want to find p3
View 2 Replies
Apr 24, 2010
Is there any good solution to having 3d vector models with texture filled surfaces using as3? I though that as3 allowed the import of models and had classes for 3d vectors, but I can't seem to find anything about it except for third party software.Here is what I am working on: I have made a 3/D game board on which a turn based game will be played. You can drag it to a variety of angels and it looks decent. This was not made with a vector object however--it was made entirely by using functions like rotateX, rotateY, and rotateZ. It still took a long time to get correct.The problem is that if I put flat pieces on the board it will not look right, and there would be far too many frames to have the pieces pre-rendered considering that you can turn the board in any direction and that the pieces are to be animated.
View 1 Replies
Mar 31, 2009
I have a number of boxes on screen - each box is a rectangular movieclip, and they fall to the bottom of the screen where they pile up to make a stack of boxes. I'm using box2d for the physics. Oh, and each box may be rotated. I need to find the highest point - ie the smallest y value, of the stack of boxes.
Obviously I can find the position of the highest box's registration point easily (which is the centre of each box) - but that may not be the highest point of the pile of boxes. The highest point may not even be the highest box - it could be a lower box that is rotated on end, for example.
View 3 Replies
Dec 7, 2010
I want to find out if the user is currently using more than one finger to draw on the screen.currently, the TouchEvent object doesn't have any property like touchCounts, which tells the number of touches on the screen. it just has a touchPointID, which helps to identify a particular touch.
do i need to handle this on my own ? for eg: in the TOUCH_BEGIN event handler i could see how many different unique touchPointID i have received and update the count myself.
View 1 Replies
Dec 23, 2010
I have two circles, an inner circle and an outter circle. I'm trying to find points that reside within the area between the edge of the inner circle and the edge of the outer circle.
View 1 Replies
May 29, 2011
I've got a grid of sprites.Now I would like to drag an image on a grid-element.Therefore I need to know which x/y of the grid-element is the closest point to the mouse-position.
View 2 Replies
Jul 4, 2011
I have a path drawn in the flash IDE, accessible as a MovieClip.
With AS3 I need to find the closest point lying on this path to another point.
View 1 Replies
Jul 29, 2011
I'm having trouble with this code
var imageMap:ImageSnapshot= ImageSnapshot.captureImage(object);
var pixelValue:uint = imageMap.bitmapData.getPixel(x, y);
View 1 Replies
Dec 6, 2009
How to find out different circle's center point of a bitmap?
just like photo above, how can i locate the 2 center points of circles?
i only know using .getColorBoundsRect to get a point, but this only apply to one circle, in fact i wanna get different points according to the bitmap.
View 1 Replies
Aug 22, 2010
I have a MovieClip that has four circles on the stage. Each circle draws a line to the other three circles. I'm trying to figure out how to find the intersect point between all of the lines. If there is no intersect point, then the circle in the middle should become the intersect point. I've uploaded the SWF here: [URL].
Here is the code for generating the lines:
ActionScript Code:
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.sensors.Accelerometer;
public class IntersectTest extends MovieClip {
[Code] .....
View 7 Replies
Dec 1, 2010
I'm trying to add some zooming functionality. The problem is that when you zoom in and out, it scales the MC up and down from where the registration point is. This means That when I'm far from the position of the registration point instead of zooming the in straight it also makes it appear as if you are travelling towards the registration point.
To offset this effect I want to calculate the amount of pixels I need to offset the Map by so that it appears as if you are zooming in directly.
So just as a test I've put a little ball inside the map(called "center") which I'm trying to keep in the center of the map.[code]...
View 1 Replies
May 2, 2010
I have a rectangle of any arbitrary width and height. I know X,Y, width, and height. How do I solve the upper right hand coordinates when the rectangle is rotated N degrees? I realized if it were axis aligned I would simply solve for (x,y+width). Unforunatly this doesn't hold true when I apply a transform matrix on the rectangle to rotate it around its center.
View 2 Replies
Sep 8, 2010
I know the length of the triangle segments and the xy coordinates of two points. How do I figure out the xy of the 3rd point?
View 3 Replies
May 20, 2010
I'm drawing a 3D pie chart that is calculated with in 3D vectors, projected to 2D vectors and then drawn on a Graphics object. I want to calculate the most left and right point of the circle after projected in 2d. (So not 0 and 1 Pi!) The method to create a vector, draw and project to a 2d vector are below. Anyone knows the answer?
[Code]...
View 1 Replies
Sep 14, 2011
I have made racing games in the past, but never a side scrolling type.Im trying to make one similar to this: http:[url]...But how would you keep the player on the ground? well not stuck to the ground because we would want the player to be able to use things like ramps.
View 5 Replies
Oct 14, 2008
im making a 2d game with platforms and walls and floors and such, i've got most of the physics i need. gravity, speed, ect. But when he is supposed to stop after "hitting the ground he just goes straight thru. The ground he should stop at is a mc called bg and inside is a mc called platform. what am i doing wrong?
Code:
onClipEvent(enterFrame){
//Keeps Character from going thru the floor, roof & walls
if(this.hitTest(_root.bg.platform)==true
gravity = 0;
}
View 4 Replies