Page 2 of 2 FirstFirst 12
Results 41 to 69 of 69

Thread: DirectPhysics

  1. #41
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: DirectPhysics

    Ragging Gremmy for his terible memory..
    thanks to me

    @JR or moeur, could you please elaborate more on DPMaths, Force etc, the functions they include, on how we want these functions to work?

    Harsh Gupta
    Show Appreciation. Rate Posts.

  2. #42

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    DPMath is gonna contain some the same functions as the Direct3DX class, see here, from DirectX, only it will contain more physics based math functions, and will have just the vector, matrix, and quaternion math from the other library I have in the link. The reason why we must recreate these functions is because I don't want DirectPhysics to be dependent on DirectX in order to run the math functions. I also want to rename them to DP instead of D3DX.

    Also, DPForce will contain functions that calculate Gravity, Air Resistance (aka Air Drag), Friction, Normal force, Magnetic, Applied, Buoyant, Electrical, Vacuum, Tensional, and Spring force. Torque, I'm not sure should go there or be in a separate class, but we will see. There will even be a function called Add, that will add whatever forces you apply to it, which in effect automatically puts it into Net force.

    There will be 2 to 4 versions of each force, depending on whatevers possible between 1D to 3D. 4D is for when people use 'w', which is usually always 1.

  3. #43
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: DirectPhysics

    has any body seen my car keys....

    oh uh...

    oh all this math talk is confusing me... Not really but anyway...

    I downloaded visual c++ 2005 today, I couldnt even see where to type in code! I might be willing to learn, if it will benifit me in the future. I do plan on seeking employment in this field, as I have not grown bored of it. Yet...

    So if anyone has anygood links on good visuall c++ 2005 , that would be great.

    I figure for this project, I might not have to learn to much, but I know it will be harder than I think
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  4. #44

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Does anyone have any other questions before we begin coding?

  5. #45

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Ok, let's begin then. To help everyone code this, I'm gonna bring out a series of formulas for every force, or some of them for now. Some of them don't have any formula.

    Table
    N - Normal force
    μ - Friction coefficient
    m - Mass
    g - Gravity
    C - Drag coefficient
    p - Air density
    v - Velocity
    A - Area
    x - Position
    x0 - Initial Position
    k - Spring stiffness


    Formulas

    Gravitational: None
    Friction: μ * N
    Normal: m * g
    Air Drag: 0.5 * C * p * A * v²
    Spring: -k * (x - x0)

  6. #46
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: DirectPhysics

    Not to nitpick, but:

    Gravitational force: F(g) = GMm/r^2
    The gravtitaional force between two objects of masses M and m, separated by r. G is the gravitational constant (very small). It acts along the line joining their centres of gravity.

    Weight: F(w) = mg
    For an object of mass m, the weight is mg where g is the acceleration due to gravity. On Earth, this is ~9.81ms^-2. On the local scale, this is always straight down.

    Normal force: F(N) is of variable magnitude, but always acts perpendicular to the surface. When an object is on the tabletop and in equilibrium, then the Normal force is equal to the weight. However, things can get much more complicated....see diagram.

    Friction: F(f) is the frictional force; usually F(f) <= uN where u is the coefficient of friction and N is the Normal force. F(f) acts to oppose the direction of motion. The frictional force does not increase forever, nor is it a constant and equal to uN.

    Springs: F(s) = -kx where k is the spring constant and x is the extension of the spring. Only valid in the regime in which the spring returns to its initial length when released. Springs can be overstretched.


    zaza
    Attached Images Attached Images  

  7. #47

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Actually zaza, GMm/r^2 is used to calculate the gravity of a planet or a moon, which isn't really that useful in a physics engine, and is hardly ever used.

    Although Normal force and weight have the same formula m*g, they are not the same thing cause a normal force isn't always going straight down like weight is.

    And in the Spring force equation -k*x, x is calculated (x - x0) to obtain the length of the spring.

  8. #48
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: DirectPhysics

    Evening,

    I don't wish to be a nuisance, but it's worth getting these things right.

    GMm/r^2 is used to calculate the gravity of a planet or a moon, which isn't really that useful in a physics engine, and is hardly ever used.
    Actually, this is the Universal Law of gravitation. It applies to everything! For someone such as yourself, or any other object on the Earth, the gravitational force must be equal and opposite to the weight.
    Hence:

    mg = GMm/r^2

    The m's cancel, leaving g (accel due to gravity) = GM/r^2. These are (more or less) constants, G = 6.67x10^-11 m^3/kg/s^2, M (of Earth) = 5.976x10^24 kg, radius (of Earth) = 6378137m. Fill these in, and you get g = 9.81ms^-2, exactly as we all know. So arguably, this formula is of more use than simply a constant g.


    Although Normal force and weight have the same formula m*g, they are not the same thing cause a normal force isn't always going straight down like weight is.
    Having re-read my post, I realise I didn't necessarily make it clear that the Normal force usually acts in the opposite direction to the weight. However, this should be clear from the diagram. They very much are not the same thing, and the Normal force does not have the same formula as the weight.


    My point about the spring equation is simply that springs are not necessarily infinitely extensible. I realise that your x-x0 is intended to represent the extension.



    Can I make the further plea - please consider putting universal gravity in. Your users will honestly love you for it, and it really isn't difficult.



    zaza

  9. #49

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Fine, I'll have that Gravity formula in, but since we already are gonna have many constants in our engine that will represent gravity for certain planets and our moon, not to mention the user can put in his/her custom gravity constant, I don't really see the need, but it'll be there.

    By the way, weight and Normal force are the same equation, m * g. Just that Normal force has it as a vector, and optionally multiplied by an angle:

    Fn.x = m * g.x
    Fn.y = m * g.y
    Fn.z = m * g.z

  10. #50
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: DirectPhysics

    In the diagram above, for an object not on horizontal ground (as most objects will not be), the normal force is not equal and opposite to the weight. It is equal to the component of the weight force in the direction perpendicular to the surface.

    It is clear in the diagram that the weight has no component in the x direction, but the Normal force does. Also, the magnitude of the Normal force is not the same as that of the weight. The motion of the object down the slope depends upon whether or not the component of the weight in the direction parallel to the slope is greatr than that of the friction in the other direction. Tilt your head to the left and it will be clearer. This also explains why the frictional force can vary - it can't be bigger than the component of the weight along the direction of the slope because otherwise the object would float uphill. It can be less, however, and so the object slides down the slope.


    zaza
    Last edited by zaza; Feb 23rd, 2006 at 12:33 PM.

  11. #51
    Member SAGremlin's Avatar
    Join Date
    Jan 2006
    Location
    JHB South Africa...
    Posts
    58

    Re: DirectPhysics

    Okay just to break up all the serious talk here.. I have seen objects float Uphill...

    Seriously.. So parts here we have some hills with very strong magnetic iron ore.. You stop the car, let go of the brakes and the car Slowly rolls UPHILL.. And just to check that it is indeed uphil, we dumped a drum of water on the road(Been non magnetic), it went in the opposite direction.

    A compas in that area is useless.. From about a Km (2/3 Mile) away you still pick up residule effects of the magnetic field..

    Gremmy..
    ____________________________________________

  12. #52
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: DirectPhysics

    Sounds to me like we need to get a strong vector engine up and running before anything else.

    Also, are we going to be inculding any non-physical physics (okay, that didn't make sense ). I mean are we going to be doing anything with light or sound or anything? I kind of doubt it, but I thought I might bring it up.

    If anyone is interested I attached a .DOC that I made for my physics class. It has most of the basic formulas and some stuff that we won't use at all. I think it is pretty helpful. I will update it from time to time and post it here.
    Attached Files Attached Files
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  13. #53
    Member SAGremlin's Avatar
    Join Date
    Jan 2006
    Location
    JHB South Africa...
    Posts
    58

    Re: DirectPhysics

    I like what i see in the document..

    Now we need to get these into fast code..

    PS .. Jacob .. You must add that i'm the VB 6 class tester on the front page ..
    ____________________________________________

  14. #54
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: DirectPhysics

    Afternoon,

    I've tried to hint at it before - this time I'll be more explicit. Why not just implement the general code to express any force in any direction? To get the direction, all you'd need is the vector joining one object to another object. To get the magnitude, you can then bolt on whichever "Force calc" you like. This gives maximum flexibility to the end user whilst still being easy to code.

    In order to keep the speed up and the number of calcs to a minimum, you could give an object two properties for a force, e.g. Object.EmitGravity and Object.FeelGravity. When you work out the gravitational force on objects, you only calculate the force on those with Object.FeelGravity = True and calculate the magnitude in the direction of all those objects with Object.EmitGravity = True. This will be of much use when there are large numbers of objects, because you can set the FeelGravity = True property only when a collision occurs on an object. Hence as you are driving your tank towards a stack of crates, you don't need to be constantly calculating forces to check whether they are balanced or not - just set the FeelGravity property when the collision occurs and let DirectPhysics take over.
    In this regime, all you then need to do is bolt in the expression for the gravitational force between objects and call it in when needed. Do the same for magnetic, frictional, etc.
    To simulate gravity, you would then just need to create a point mass at a large distance below the game area and set its EmitGravity property to True. This would be the only emitting object (so you aren't calculating tiny forces between the player and a nearby tree), and the user could easily set the size of the mass, distance away etc. And hey presto, you've built in a fully functioning gravity simulator that will cover any circumstance. The same applies for all the other forces.

    Suppose I have a stack of crates in the above diagram rather than just one. What is the Normal force on the bottom crate? You have not only the weight of that crate to worry about, but all the ones stacked on top of it, hence just arbitrarily bunging in an (mg cos theta) won't be correct. You need to calculate it for each crate in relation to the other crates - and hence you need to be able to swiftly do these sums. Clearly in this circumstance, as you iterate through all the objects in the game area and calculate all the forces on each one, you need to do them in the correct order otherwise you might not work out that the top crate is resting on the bottom crate. Or you have to do all calcs simultaneously - not great for speed. Or, you implement a "contact force" whenever two objects are touching and set the flag on this just as you do for any other force. Then, when working out the net force on any given object, you can trace back through the contact forces to work out the overall net force.

    These are things you need to think about now, not in 3 months when the engine is halfway done and suddenly nothing is behaving as expected.

    I understand the desire to get coding, but a few hours spent now will definitely save many weeks later.

    zaza

  15. #55

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Quote Originally Posted by eyeRmonkey
    Sounds to me like we need to get a strong vector engine up and running before anything else.

    Also, are we going to be inculding any non-physical physics (okay, that didn't make sense ). I mean are we going to be doing anything with light or sound or anything? I kind of doubt it, but I thought I might bring it up.

    If anyone is interested I attached a .DOC that I made for my physics class. It has most of the basic formulas and some stuff that we won't use at all. I think it is pretty helpful. I will update it from time to time and post it here.
    Light and sound physics are not used in physics engines cause they are not needed. Just done in classrooms and labs. Nice Doc by the way.

    Quote Originally Posted by SAGremlin
    I like what i see in the document..

    Now we need to get these into fast code..

    PS .. Jacob .. You must add that i'm the VB 6 class tester on the front page ..
    Done.

    @ zaza:

    I already planned on adding angles for any of the forces.

  16. #56

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    The most important thing that is gonna be in our physics engine is the Integration class, which should be easy to code. It's gonna allow the user to choose an integration method, and will have a function to execute it. Some methods will be inaccurate and unstable, while others have their own pros and cons. It all depends on what you do. Like for example, Runge Kutta 4 would be perfect for spring simulations. While Runge Kutta methods (especially the higher order ones) are the most accurate and stable yet computationally expensive, Euler is the easiest to implement, yet is inaccurate and can easily become unstable. For future reference just incase I seem like I'm jumping the gun, here are some, which happen to be the most popular choices of integration methods:


    x - Position
    v - Velocity
    a - Acceleration
    dt - Delta Time Step Size


    Euler
    Aliases: Forward Euler, Explicit Euler
    ----------------------------------------
    x = x + v * dt
    v = v + a * dt

    2nd Order Euler
    ----------------------------------------
    x = x + v * dt + 0.5 * a * dt * dt
    v = v + a * dt

    Verlet
    Aliases: Velocity-less Verlet
    ----------------------------------------
    v = x - old_x + a * dt * dt
    x = x + v
    old_x = x

    Time Corrected Velocity-less Verlet
    ----------------------------------------
    v = (x - old_x) * (dt / old_dt) + a * dt * dt
    x = x + v
    old_x = x
    old_dt = dt

    Prescaled Euler
    Aliases: Newton Stomer Verlet Variant
    ----------------------------------------
    v = v + a * dt * dt
    x = x + v

    Re-ordered traditional Euler
    Aliases: Semi-Implicit Euler, Newton Stormer Verlet, Backwards Euler
    ----------------------------------------
    v = v + a * dt
    x = x + v * dt

    Velocity Verlet
    ----------------------------------------
    x = x + v * dt + 0.5 * Old_A * dt * dt
    v = v + 0.5 * (Old_A + a) * dt
    Old_A = a

    2nd Order Runge Kutta,
    Aliases: Midpoint Method, RK2
    ----------------------------------------
    k1 = dt * v
    l1 = dt * a

    k2 = dt * (v + k1 / 2)
    l2 = dt * a

    x = x + k2
    v = v + l2

    3rd Order Runge Kutta
    Aliases: RK3
    ----------------------------------------
    k1 = dt * v
    l1 = dt * a

    k2 = dt * (v + k1 / 2)
    l2 = dt * a

    k3 = dt * (v - k1 + 2 * k2)
    l3 = dt * a

    x = x + k1 * 1 / 6 + k2 * 2 / 3 + k3 * 1 / 6
    v = v + l1 * 1 / 6 + l2 * 2 / 3 + l3 * 1 / 6

    4th Order Runge Kutta
    Aliases: RK4
    ----------------------------------------
    k1 = dt * v
    l1 = dt * a

    k2 = dt * (v + k1 / 2)
    l2 = dt * a

    k3 = dt * (v + k2 / 2)
    l3 = dt * a

    k4 = dt * (v + k3)
    l4 = dt * a

    x = x + k1 / 6 + k2 / 3 + k3 / 3 + k4 / 6
    v = v + l1 / 6 + l2 / 3 + l3 / 3 + l4 / 6






    And here's some code examples, which show the results of each of them:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Activate()
    4.    
    5.     Dim k1 As Single, k2 As Single, k3 As Single, k4 As Single
    6.     Dim l1 As Single, l2 As Single, l3 As Single, l4 As Single
    7.  
    8.     Dim x As Single, v As Single, a As Single
    9.  
    10.     Dim dt As Single, dt2 As Single
    11.     Dim f As Single, m As Single
    12.  
    13.     Dim old_x As Single, old_a As Single, old_dt As Single
    14.  
    15.     Dim i As Long
    16.  
    17.     a = 9.8
    18.     dt = 1 / 100
    19.    
    20.     'List1.AddItem ""
    21.     List1.AddItem "Euler Integration"
    22.     List1.AddItem "---------------------"
    23.  
    24.     x = 0
    25.     v = 0
    26.    
    27.     For i = 0 To 99
    28.    
    29.         x = x + v * dt
    30.         v = v + a * dt
    31.    
    32.         List1.AddItem "X: " & x & "    " & "V: " & v
    33.    
    34.     Next i
    35.    
    36.     List1.AddItem ""
    37.     List1.AddItem "2nd Order Euler Integration"
    38.     List1.AddItem "---------------------"
    39.  
    40.     x = 0
    41.     v = 0
    42.    
    43.     For i = 0 To 99
    44.    
    45.         x = x + v * dt + 0.5 * a * dt * dt
    46.         v = v + a * dt
    47.    
    48.         List1.AddItem "X: " & x & "    " & "V: " & v
    49.    
    50.     Next i
    51.    
    52.     List1.AddItem ""
    53.     List1.AddItem "Newton Stormer Verlet (Semi Implicit Euler)"
    54.     List1.AddItem "---------------------"
    55.  
    56.     x = 0
    57.     v = 0
    58.    
    59.     For i = 0 To 99
    60.    
    61.         v = v + a * dt
    62.         x = x + v * dt
    63.    
    64.         List1.AddItem "X: " & x & "    " & "V: " & v
    65.    
    66.     Next i
    67.    
    68.     List1.AddItem ""
    69.     List1.AddItem "Velocity-less Verlet Integration"
    70.     List1.AddItem "---------------------"
    71.  
    72.     x = 0
    73.     v = 0
    74.    
    75.     For i = 0 To 99
    76.    
    77.         v = x - old_x + a * dt * dt
    78.         old_x = x
    79.         x = x + v
    80.    
    81.         List1.AddItem "X: " & x & "    " & "V: " & v / dt
    82.    
    83.     Next i
    84.    
    85.     List1.AddItem ""
    86.     List1.AddItem "Newton Stormer Verlet Variant Integration"
    87.     List1.AddItem "---------------------"
    88.  
    89.     x = 0
    90.     v = 0
    91.     dt2 = dt * dt
    92.    
    93.     For i = 0 To 99
    94.    
    95.         v = v + a * dt2
    96.         x = x + v
    97.    
    98.         List1.AddItem "X: " & x & "    " & "V: " & v / dt
    99.    
    100.     Next i
    101.    
    102.     List1.AddItem ""
    103.     List1.AddItem "Velocity Verlet Integration"
    104.     List1.AddItem "---------------------"
    105.  
    106.     x = 0
    107.     v = 0
    108.     old_a = a
    109.    
    110.     For i = 0 To 99
    111.    
    112.         x = x + v * dt + 0.5 * old_a * dt * dt
    113.         v = v + 0.5 * (old_a + a) * dt
    114.         old_a = a
    115.    
    116.         List1.AddItem "X: " & x & "    " & "V: " & v
    117.    
    118.     Next i
    119.    
    120.     List1.AddItem ""
    121.     List1.AddItem "Time Corrected Velocity-less Verlet Integration"
    122.     List1.AddItem "---------------------"
    123.  
    124.     x = 0
    125.     v = 0
    126.     old_x = x
    127.     old_dt = dt
    128.    
    129.     For i = 0 To 99
    130.    
    131.         v = x - old_x * (dt / old_dt) + a * dt * dt
    132.         old_x = x
    133.         old_dt = dt
    134.         x = x + v
    135.        
    136.         List1.AddItem "X: " & x & "    " & "V: " & v / dt
    137.    
    138.     Next i
    139.  
    140.     List1.AddItem ""
    141.     List1.AddItem "RK2 Integration"
    142.     List1.AddItem "---------------------"
    143.  
    144.     x = 0
    145.     v = 0
    146.  
    147.     For i = 0 To 99
    148.  
    149.         k1 = dt * v
    150.         l1 = dt * a
    151.        
    152.         k2 = dt * (v + k1 / 2)
    153.         l2 = dt * a
    154.        
    155.         x = x + k2
    156.         v = v + l2
    157.        
    158.         List1.AddItem "X: " & x & "    " & "V: " & v
    159.  
    160.     Next i
    161.    
    162.     List1.AddItem ""
    163.     List1.AddItem "RK3 Integration"
    164.     List1.AddItem "---------------------"
    165.  
    166.     x = 0
    167.     v = 0
    168.    
    169.     For i = 0 To 99
    170.    
    171.         k1 = dt * v
    172.         l1 = dt * a
    173.                
    174.         k2 = dt * (v + k1 / 2)
    175.         l2 = dt * a
    176.                
    177.         k3 = dt * (v - k1 + 2 * k2)
    178.         l3 = dt * a
    179.                
    180.         x = x + k1 * 1 / 6 + k2 * 2 / 3 + k3 * 1 / 6
    181.         v = v + l1 * 1 / 6 + l2 * 2 / 3 + l3 * 1 / 6
    182.        
    183.         List1.AddItem "X: " & x & "    " & "V: " & v
    184.    
    185.     Next i
    186.    
    187.     List1.AddItem ""
    188.     List1.AddItem "RK4 Integration"
    189.     List1.AddItem "---------------------"
    190.  
    191.     x = 0
    192.     v = 0
    193.  
    194.     For i = 0 To 99
    195.  
    196.         k1 = dt * v
    197.         l1 = dt * a
    198.        
    199.         k2 = dt * (v + k1 / 2)
    200.         l2 = dt * a
    201.        
    202.         k3 = dt * (v + k2 / 2)
    203.         l3 = dt * a
    204.        
    205.         k4 = dt * (v + k3)
    206.         l4 = dt * a
    207.        
    208.         x = x + k1 / 6 + k2 / 3 + k3 / 3 + k4 / 6
    209.         v = v + l1 / 6 + l2 / 3 + l3 / 3 + l4 / 6
    210.        
    211.         List1.AddItem "X: " & x & "    " & "V: " & v
    212.  
    213.     Next i
    214.  
    215. End Sub

  17. #57
    Member SAGremlin's Avatar
    Join Date
    Jan 2006
    Location
    JHB South Africa...
    Posts
    58

    Re: DirectPhysics

    All this code is good.. IN VB its slow, Or too slow for multiple calculations..
    And it uses a lot of floating point calculations.. Writing this in C++ and using some ASM to do some of the FPC.. Also using Ref. tables and Aproximation helps to speed up things..

    Gremmy...
    ____________________________________________

  18. #58
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: DirectPhysics

    sorry for no replies in past few days, but i am having some problem with my broadband connection, but i have started working on dpMatrix class (in C++), will try to post it for your views assp.

    Harsh Gupta
    Show Appreciation. Rate Posts.

  19. #59

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Quote Originally Posted by SAGremlin
    All this code is good.. IN VB its slow, Or too slow for multiple calculations..
    And it uses a lot of floating point calculations.. Writing this in C++ and using some ASM to do some of the FPC.. Also using Ref. tables and Aproximation helps to speed up things..

    Gremmy...
    It was just an example on showing the results of each integrator. Of course it's gonna be rewritten for C++ and possibly some ASM.

    Quote Originally Posted by Harsh Gupta
    sorry for no replies in past few days, but i am having some problem with my broadband connection, but i have started working on dpMatrix class (in C++), will try to post it for your views assp.

    Harsh Gupta
    Can't wait to see it. Hopefully it's got the same functions as DirectX's.

    Speaking of no replies, it almost seemed as though everyone on the team gave up until you two replied.

  20. #60
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: DirectPhysics

    Quote Originally Posted by Jacob Roman
    Speaking of no replies, it almost seemed as though everyone on the team gave up until you two replied.
    IMHO, this is the result of poor planning. You need to lay out a detailed plan and assign tasks if you want to see anything happen. Take a look at frogect rotamiton. The project was broken down into parts and each person was assigned their own task(s). You can't expect use to just read your mind and go off and get things done without some idea of what you want done.

    Yes, you have given us some idea, but that is about all. If you don't break this project down into a detailed list of tasks and make goals about when you want things done then this project will remain paralyzed.

    I'm not trying to be a jerk, I just want this project to succeed.
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  21. #61

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Quote Originally Posted by eyeRmonkey
    IMHO, this is the result of poor planning. You need to lay out a detailed plan and assign tasks if you want to see anything happen. Take a look at frogect rotamiton. The project was broken down into parts and each person was assigned their own task(s). You can't expect use to just read your mind and go off and get things done without some idea of what you want done.

    Yes, you have given us some idea, but that is about all. If you don't break this project down into a detailed list of tasks and make goals about when you want things done then this project will remain paralyzed.

    I'm not trying to be a jerk, I just want this project to succeed.
    Maybe it's just me. No matter how hard I try and plan, it always ends up poorly planned, like what happened in LightFusion. I think it's best I leave that job to you, eyeRmonkey, since you know what you are doing. If you accept, then you are our new Project Planner.

  22. #62
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: DirectPhysics

    i agree with you ERM, since i dont know "what to do next", since i dont have relevant experience of DX, thats why it is taking so much time.

    on a serious note, it becomes boring when you dont know what to do, what the problem actually expects the function to perform.

    i am really sorry to say JR, but it will take some more time if you need all the functions listed in the MSDN (link in post #42).

    Harsh Gupta.

    PS: sorry if anyone find me rude. i wasn't meant to be.
    Show Appreciation. Rate Posts.

  23. #63

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    I do know what I'm doing and all, it's just that no matter what plan I lay out, it doesn't seem planned correctly. Which is why I plan on leaving that task to eyeR.

    Me and damasterjo know the DX syntax very well, and will be glad to assist on your syntax.

  24. #64
    Frenzied Member zaza's Avatar
    Join Date
    Apr 2001
    Location
    Borneo Rainforest Habits: Scratching
    Posts
    1,486

    Re: DirectPhysics

    OK, here's something to get the ball rolling. It's a set of basic coordinate transform and vector algebra classes. There are cartesian, spherical-polar and cylindrical-polar coordinate systems and vectors in the cartesian system.

    The global cartesian coordinate system has its origin at (0,0,0), and is easily replicated by:

    VB Code:
    1. Dim Global as CoordinateSystem.Cartesian

    Other coordinate systems can be added in similar fashion. They can be offset in cartesian coordinates from the Global system using the XOffset, YOffset and ZOffset properties. They can also be rotated using the ThetaRotation and PhiRotation properties, where Theta is the angle in radians (0 to 2Pi) from the X axis towards Y and Phi the elevation towards Z (Pi/2 to -Pi/2). See picture.

    If a system is specified as Spherical then the R axis is the Radius from the origin of the system, the Theta axis is the angle (0 to 2Pi) around from the local cartesian x-axis (as in the rotation above) and the Phi axis is the elevation (Pi/2 to -Pi/2) towards the local cartesian z-axis (again as above).
    Similarly for Cylindrical coords, the R axis is the radius in the xy plane, Theta is the angle anticlockwise from the x-axis and Z is the z-axis.

    Vectors can be specified in terms of two cartesian coordinates or in terms of x1, x2, y1, y2, z1, z2 values. The Length property retrieves the length or, if set, rescales the vector keeping the same x1,y1,z1 point.

    Operations contains Angle operations to convert degrees to radians and vice versa, coordinate transforms and vector algebra. Coordinate Transforms include:

    Converting a coordinate in one local system to an equivalent point in a different local system (e.g. (1,1,1) in cartesians to (sqrt3, Pi/4, atan(1/sqrt2)) in Spherical Polars etc). These are the LocalCartToSph etc functions.

    Determining a new local cartesian point when the cartesian system is rotated by Theta and Phi. This is the RotateCartesian function.

    Representing a coordinate in any one system in any other system. This is the overloaded Coordinate function.


    There are also Vector operations, including Add, Subtract, DotProduct and CrossProduct. I plan to keep adding stuff to this, but it may be of interest now to some.


    Have a play and see what you think.


    zaza


    Edit: It may need testing fully...



    Edit again: See the link in sig.
    Last edited by zaza; Mar 27th, 2006 at 12:59 PM.

  25. #65
    No place like 127.0.0.1 eyeRmonkey's Avatar
    Join Date
    Jul 2005
    Location
    Blissful Oblivion
    Posts
    2,306

    Re: DirectPhysics

    I have to respectfully decline the position of project planner. I am not the best at planning either and I don't have enough time to manage that right now. Sorry.

    Maybe someone else would be willing to take up this role?
    Visual Studio 2005 Professional Edition (.NET Framework 2.0)
    ~ VB .NET Links: Visual Basic 6 to .NET Function Equivalents (Thread) | Refactor! (White Paper) | Easy Control for Wizard Forms | Making A Proper UI For WinForms | Graphics & GDI+ Tutorial | Websites For Free Icons
    ~ QUOTE: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -Rich Cook

    ~ eyeRmonkey.com

  26. #66

    Thread Starter
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: DirectPhysics

    Ok I'll plan it, but I'm gonna need lots of time. I have no clue how many classes are gonna be in it just yet.

  27. #67
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: DirectPhysics

    Hey im emersed in my project right now, and wont have time to help with this one, so you can take me off the team.

    :EDIT: Sorry if that sounded rude, its just that, I am having so much fun with my projects and the graphics are really shaping up. So I wont really have time, although if you needed a small specific task or just wanted to ask a question or something, I would be happy to help.
    Last edited by damasterjo; Mar 10th, 2006 at 12:29 PM.
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  28. #68
    Member SAGremlin's Avatar
    Join Date
    Jan 2006
    Location
    JHB South Africa...
    Posts
    58

    Re: DirectPhysics

    Okay I still have no clue as to who's doing what here... Ermm, I'm not a coder in the project ( No C++ skills), but i'd like to know when to expect the first DLL to test...

    Also something else i've been thinking about..

    Do we realy have to do collision detection.. That basically meens that the Classes have to hold the entire body matrix.. this is a bit extreem... I recon rather hold only a reference X,Y,Z point (Center preferable..) ,Mass , X/Y/Z velocity, etc.. let the user do collision detection, And simply call a Collision with object function, with the details of the different objects that colided..

    This will make it a lot easier to code the classes needed, and speed up the calculations.

    Gremmy....
    ____________________________________________

  29. #69
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: DirectPhysics

    are we supposed to do any work???
    Show Appreciation. Rate Posts.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width