3D Vector Physics (practical situation)

In summary, the conversation discusses a problem encountered while programming a vector-based 3D engine in Flash and the limitations of the current z-sorting algorithm. The speaker explains their current method of using the average z-value of each plane to sort them from front to back, but acknowledges that it limits flexibility in design and may not always accurately determine which plane is in front. They also mention the limitations of the programming language used and the desire for a more efficient system. There is a suggestion to use a z-buffer and the question of whether Flash can use OpenGL.
  • #1
Alphabit
6
0
Hi everyone, this is my first post on this forum.

Anyway, I was hoping that you might be able to solve a problem I've encountered while programming a vector-based 3D engine in Flash. Here's an example of what I made with it:
http://jongro.phpnet.us/space.html" - It might look like it's working fine, but there is a limitation...

Basically, the API I made takes arrays of 3D planes which are grouped into Building Blocks (a series of planes grouped together to form a 3D basic shape)... Then each of these building blocks is assembled into a final 3D object which you should be able to see in the link above.

Now, you don't really need to worry about the structure, but it might help you find a solution. In any case, each plane has exactly 4 3D points (x, y, z) and, using these 3D points, I need to find a way to arrange the planes in 3D space from front to back. *EDIT* to make a triangular shape, I just set two of the points to the same coordinates... And yes, I know this causes problems with my current z-sorting algorithm*/EDIT*

The way I've done it is took the average z-value of every point in each plane which gave me the "z-index center point" of each plane at any time and I used this number to sort the planes from greatest to least... And display them on the screen accordingly.

Now The problem with this is that It allows very little flexibility in the design of my 3D objects. Take this for http://jongro.phpnet.us/3ddddd.gif" (they won't make a great deal of sense as they are, but you'll get the drift).
From looking at the diagram we can tell that the semi-transparent square-plane will be in front of the other one... But the problem is that, in some cases, the average z-index will not accurately tell which plane is in front.

Another problem is that, due to the limited processing power of the programming language I am using (ActionScript 3.0), I cannot have it do a per-pixel z-sorting... Instead I have to find a way to make the z-sorting work using Vector physics or other mathematical concepts.

Also, it might be processor intensive if I were to do comparative-checking, but if you've got a good way of doing it, please share.
That being said, I would rather have a system where every plane generates a value which will automatically place it in the correct position if sorted numerically against other planes.

Is there a way to do this, please share your ideas on this, thanks.

P.S. Please avoid using mathematical terms or if you do, tell me what they represent because I'm not much of a mathematician or physicist.:smile:
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
... It seems more complicated than I thought.
Does anyone have any pointers on this? Is it even possible?

Thanks
 
  • #3
Your video card normally uses a z-buffer. Considering how far you've come already, I presume you can find out all the details yourself (basically, just keep track of the z value for each individual pixel, in order to decide whether to paint over it). Can flash use openGL?
 
  • #4
cesiumfrog said:
Can flash use openGL?

No, Flash does not support hardware acceleration; I guess Macromedia/Adobe thought it was best to keep the Flash Player as small, compact and portable as possible.
 

FAQ: 3D Vector Physics (practical situation)

What is a 3D vector in physics?

A 3D vector in physics is a mathematical quantity that has both magnitude and direction in three-dimensional space. It is represented by an arrow with a specific length and direction, and is used to describe physical quantities such as displacement, velocity, and force.

How is 3D vector physics used in practical situations?

3D vector physics is used in various practical situations, such as in engineering, robotics, and computer graphics. It allows us to accurately describe and analyze the motion and forces acting on objects in three-dimensional space, which is essential for understanding and designing complex systems.

What are the key components of a 3D vector?

The key components of a 3D vector are its magnitude, direction, and orientation. The magnitude is the length of the vector, the direction is the line along which the vector is pointing, and the orientation is the angle between the vector and a reference axis.

How do you perform vector operations in 3D space?

To perform vector operations in 3D space, we use mathematical formulas and principles such as the Pythagorean theorem, trigonometric functions, and dot and cross products. These operations allow us to calculate the resultant vector, find the angle between two vectors, and determine the projection of one vector onto another.

What are some practical examples of 3D vector physics?

Some practical examples of 3D vector physics include calculating the trajectory of a projectile, designing the motion of a robot arm, and determining the net force acting on an object in three-dimensional space. It is also used in computer graphics to create 3D models and animations.

Similar threads

Back
Top