PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
DirectPhysics-VBForums
Page 1 of 2 12 LastLast
Results 1 to 40 of 69

Thread: DirectPhysics

  1. #1

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    DirectPhysics

    DirectPhysics

    Introduction:
    Welcome to the DirectPhysics project. We will be designing an add-on to DirectX using C++ that will allow users to easily implement realtime physics into their games. There will be 2 versions of this. One will be an ActiveX .NET object for the .NET languages. And the other will be an ActiveX COM object to be used with VB6. Anyone is welcome to suggestions, comments, and to contribute anyway you can. Feel free to PM me if you are wanting on the team.

    The Team:
    • Jacob Roman - Project Director, Math and Physics, Theory, Coder, Tester
    • moeur - Co-Project Director, Math and Physics, Theory, Coder
    • jcis - Math and Physics, Theory, Coder
    • Harsh Gupta - Math and Physics, Theory, Coder
    • eyeRmonkey - Math and Physics, Theory
    • damasterjo - Math and Physics, Theory
    • SAGremlin - Math and Physics, Theory, Tester


    Interested in being on the team?
    If you want to be a team member in this project, you must have a good math background and some experience with Physics (mainly game related physics), Calculus, and Trig. You don't need much experience with DirectX. Maybe just a little so you have a good grasp on game programming and how the DX syntax is. And if you want to help code, a good understanding of C++ and maybe a little assembly should help.

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

    Re: DirectPhysics

    I am open for an assignment. I am still unclear as to what this will offer and how it will be done. I am usually pretty good in programming math things and stuff like that. So learning the physics should not be much of a problem. Also do you want this to get to a level where, it is included in the directx package. Like one day....
    New class added Direct Physics, programmed by Jacob Roman.?
    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

  3. #3

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    The first thing I would like to suggest is to allow the user to select a numerical integration method from a list of constants to be used in a function. Here are some integration methods they can choose:

    • Forward (Explicit) Euler
    • Backward (Implicit) Euler
    • Symplectic Euler
    • Semi-Implicit Euler
    • 2nd Order Runge Kutta
    • 4th Order Runge Kutta
    • 6th Order Runge Kutta
    • (Velocity-less) Verlet
    • Time Corrected Verlet
    • Velocity Verlet
    • LeapFrog Verlet
    • Newton Stormer Verlet
    • LeapFrog
    • ...etc.


    Then when the function is called in a loop, it'll update the time steps and allow the physics to happen.

  4. #4

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by damasterjo
    I am open for an assignment. I am still unclear as to what this will offer and how it will be done. I am usually pretty good in programming math things and stuff like that. So learning the physics should not be much of a problem. Also do you want this to get to a level where, it is included in the directx package. Like one day....
    New class added Direct Physics, programmed by Jacob Roman.?
    Like I said earlier in the first post, it will allow users to easily be able to add realtime physics to their DirectX applications. Hopefully that's clear enough. Physics is an advanced topic, and many people find it too difficult to be able to implent physics on their own. This ActiveX component we are making in C++ will make it easier on them.

    It will be a separate reference, like how DirectShow is separate. Unless we work at MS and have access to their DX source code, which we don't.

  5. #5
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: DirectPhysics

    The first thing I would like to suggest is to allow the user to select a numerical integration method from a list of constants to be used in a function.
    I'd like to first see more of the big picture.

    For instance, how are we going to implement this whole thing?

    Give me an example of a task the user wants to perform and then the steps you envision him doing using our new library.

  6. #6
    Addicted Member
    Join Date
    May 2005
    Posts
    230

    Re: DirectPhysics

    Is this going to mostly involve 2d rigid body collisions?

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

    Re: DirectPhysics

    This is a very interesting under taking...

    It's more of a front end for DirectX - 3D gaming development..

    Alot of 3d development gets stuck at the pyshics area, or have dead slow code because they use alot of floating point arithmatic.. ( this is something to Aviod completely.) you only NEED to use FPA for scientific calculations..

    in 3d gamming nearest estimation works fast, and isn't noticable in the output..

    So i would say that the first objective is to find fast alternatives to most physics (FPA) calculations...

    Belive it or not simple calculation like 14% (Tax) is faster with bit manipulation than straight multiplication..

    Gremmy....
    ____________________________________________

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

    Re: DirectPhysics

    Jake,

    I'm going to be very blunt. You are jumping into this WAY too quick. I'm sure you are excited about it, but we need to learn from the mistakes we made in LightFusion. From post #3 I know you are going along way to fast. We need a much much cleared objective laid out and then a plan that details that EXTEREMLY well before we make another move.

    Of course that is just my opinion, but I think others will agree. If you don't want to design the plan then deligate it, but I think you should make the plan considering this is your project.
    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

  9. #9

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by eyeRmonkey
    Jake,

    I'm going to be very blunt. You are jumping into this WAY too quick. I'm sure you are excited about it, but we need to learn from the mistakes we made in LightFusion. From post #3 I know you are going along way to fast. We need a much much cleared objective laid out and then a plan that details that EXTEREMLY well before we make another move.

    Of course that is just my opinion, but I think others will agree. If you don't want to design the plan then deligate it, but I think you should make the plan considering this is your project.
    Ok, let's plan ahead. Sorry bout the rush, but considering the fact that Physics is a very advanced topic, this library is gonna be so big, that I wouldn't know where to start. But we can break physics down into small groups so we don't bring too much overhead to ourselves.

    DirectPhysics will be broken down into multiple classes. Each class will represent a special group, such as Force, Mass, Integrators, Time, Collision, Rigid Bodys, Ragdoll, Interpolation, etc., and with each, will also contain special functions and attributes. Like force, for example, will contain functions that calculate forces such as Friction, Applied, Gravity, Spring, Magnetic, Drag, Normal, etc., which will all be added into Net Force, which means the sum of all forces applied to an object. There will be 3 types of these functions within the classes. 1D, 2D, and 3D.

    I'd draw you a diagram, but ever since I moved out of my parents house, I don't have a computer just yet, and had to use one at a library, which doesn't allow me to do much except webbrowsing.

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

    Re: DirectPhysics

    Okay thats a good start. I assume you mean a diagram for the outline not for the physics? When you do draw up an outline you also need to inculde what is going to happen when. Not just what sections of physics there are. You also need to set aprox. deadlines for each step of the project. Without all that we are bound for failure again.

    Does anyone else have any suggestions?
    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

  11. #11

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Set a deadline for each step of the project? To be honest, I dunno how long it's gonna take, but we can work on each class one day at a time, nailing in as much as possible until completed.

    I would suggest each person to work on each class but then we would have to change our code around to make all the classes compatible. Which would suck.

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

    Re: DirectPhysics

    thank you for selecting me into this team. my intentions was to learn all the Maths and Physics stuff which are necessary, interesting and moreover, need to be remembered,

    i have few things to say:

    1- like i mentioned before, i need to learn the advanced C++ techniques (vectors, maps etc), and atleast basics of Calculus, Trigs, Numerical methods, and Physics so i can get started. so i need atlest 4-5 days (i presume i can start working properly prior to next Saturday).

    2- the reason i used "Basics of", because the last time i studied all this, was way 4-5 years back, so i still need to brush up all these by reading the theory and trying few complex problems.

    3- like your itinerary, you can assign me the basic modules before Friday and i will try to finish it in my free time.

    4- one suggestion, i quite agree with ERM. it is better to be late than be dead/ horrified/ horrostruck etc. etc.

    Harsh Gupta
    Show Appreciation. Rate Posts.

  13. #13

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    To help brush everyone up on physics, I have many places you can learn.

    Physics Classroom
    GameDev.net Articles
    DMWiki
    And ACS Project: Maya
    MyPhysicsLab, with Java source code

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

    Re: DirectPhysics

    If I may make a suggestion.

    First of all, sort out some kind of core package to deal with vectors. Include vector sums, dot products, cross products, transpose, adjoint, jacobians , grad, and anthing else you can think of. Matrices would also be useful.
    You really won't regret it, because the last thing you want is lots of different people doing vector algebra in different ways. Get this sorted at the beginning, and the rest will just plug into it.


    zaza

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

    Re: DirectPhysics

    Following on from my eariler post, I can recommend this site.
    The link to the Numerical Recipes in C++ part, although not containing the full book, does contain the first chapter about implementing vector and matrix classes in C++.
    The other links actually host the full books online for Fortran and C. There is lots of useful stuff in here, and it is very much worth reading (and the code pillaging).
    I would suggest that if you want to get stuck into some coding from the start, then getting into these basic maths classes is definitely the way to go. You will absoultely need the power they will provide later, and you can be planning the rest of the DirectPhysics engine in parallel.


    zaza

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

    Re: DirectPhysics

    Quote Originally Posted by Jacob Roman
    DirectPhysics will be broken down into multiple classes. Each class will represent a special group, such as Force, Mass, Integrators, Time, Collision, Rigid Bodys, Ragdoll, Interpolation, etc., and with each, will also contain special functions and attributes. Like force, for example, will contain functions that calculate forces such as Friction, Applied, Gravity, Spring, Magnetic, Drag, Normal, etc., which will all be added into Net Force, which means the sum of all forces applied to an object. There will be 3 types of these functions within the classes. 1D, 2D, and 3D.
    First of all thanks for letting me Join....

    Now my thoughts on this..

    We need to draw up a full list of all the fundamental Physics, including all the sub factors of each fundamental,and start building from each unique factor.

    Alot of these factors are only 1D. IE Gravity affects motion in only one direction.. Acceleration/Deceleration and the rate there of, can be coded as a single, 1D class and simply applied on the X,Y & Z axis, as needed..

    Only our bottom level classes (those the the user see) need be a full 3D type class... IE. Motion occurs in all three axis simultaniously, and needs to be applied as such...

    Our Top Level classes (The Core of the Pysics) need to be compact, but Fast..

    The only fundamental I can see problems with is Friction.. Friction values are fluid.. changing according to every concievable factor.. Temp, Mass, Surface, Speed, Direction, just to name a few predominant ones...

    Gremmy...
    ____________________________________________

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

    Re: DirectPhysics

    ...Alot of these factors are only 1D...
    you mean 2D?? i dont know if 1D objects really exists in this world??
    Show Appreciation. Rate Posts.

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

    Re: DirectPhysics

    Quote Originally Posted by SAGremlin
    We need to draw up a full list of all the fundamental Physics, including all the sub factors of each fundamental,and start building from each unique factor.

    Alot of these factors are only 1D. IE Gravity affects motion in only one direction.. Acceleration/Deceleration and the rate there of, can be coded as a single, 1D class and simply applied on the X,Y & Z axis, as needed..

    Only our bottom level classes (those the the user see) need be a full 3D type class... IE. Motion occurs in all three axis simultaniously, and needs to be applied as such...

    Our Top Level classes (The Core of the Pysics) need to be compact, but Fast..

    The only fundamental I can see problems with is Friction.. Friction values are fluid.. changing according to every concievable factor.. Temp, Mass, Surface, Speed, Direction, just to name a few predominant ones...

    I realise I'm not part of the team, so I hope you won't think I'm interfering, but I really would advise against going from the top down. Don't worry so much about what you want to put in it yet, worry about how to get it implemented. Once the maths behind it is solid, then the equations will flow therefrom. In the above statements, for example, I wouldn't go into details about gravity acting in 1 dimension, or applying acceleration / deceleration in 1D on an axis as required. When you have multiple systems, such as modelling the solar system for example, then you'll have multiple gravitational forces acting in different directions. What you'll be interested in is the resultant gravitational force, so you'll be doing vector sums. As i say, IMHO you'd be far better off coding general vector algebra in, then applying this to gravitational forces, magnetic forces, frictional forces etc etc.
    Stuff like vector operations (algebra, calculus etc), matrix operations etc will be essential regardless of the physics equations to which you apply it, and you will then have far greater scope to include the physics that you want later. Regardless of the physics you'll need, I guarantee that you will need these maths operations, so better to get it in at the start.


    zaza

  19. #19
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: DirectPhysics

    I agree with zaza about where we should start. However we still need to decide what the end product is going to look like so that we can work toward that goal.

    Here is how I picture the end product is going to be used. I'f I'm way off base then say so.
    Something like this
    VB Code:
    1. Dim myPhysics As clsDirectPhysics
    2. Set myPhysics = New clsDirectPhysics
    3.  
    4. 'add bodies
    5. Dim myBody As clsDPBody
    6. Set myBody = New clsDPBody
    7.  
    8. With myBody
    9.     .Mass = 10 'kg
    10. 'set initial coordinates and velocity
    11.     With .Rectangular
    12.         .X = 100000 'm
    13.         .Y = 200000 'm
    14.         .Z = 0 'm
    15.         .Vx = 1000 'm/s
    16.         .Vy = 500 'm/s
    17.         .Vz = 0
    18.     End With
    19.  
    20. 'Alternatively we could use spherical or cylindrical coordiantes
    21.     With .Spherical
    22.         .Radius = 223607 'm
    23.         .Theta = 0.463 'radians
    24.         .phi = 0
    25.     End With
    26.  
    27. End With
    28. myPhysics.Bodies.Add myBody
    29.  
    30. With myBody
    31.     .Mass = 1000000 'kg
    32. 'set initial coordinates and velocity
    33.     With .Rectangular
    34.         .X = 0
    35.         .Y = 0
    36.         .Z = 0
    37.         .Vx = 0 'm/s
    38.         .Vy = 0 'm/s
    39.         .Vz = 0
    40.     End With
    41. End With
    42. myPhysics.Bodies.Add myBody
    43.  
    44.  
    45. 'use a gravitational force
    46. Dim Force1 As clsGravity
    47. Set Force1 = New clsGravity
    48.  
    49. myPhysics.Forces.Add Force1
    50. Set Force1 = Nothing
    51.  
    52. 'add a frictional force
    53. Dim Force2 As clsFriction
    54. Set Force2 = New clsFriction
    55. Force2.Coeffecient = 0.5
    56.  
    57. myPhysics.Forces.Add Force2
    58. Set Force2 = Nothing
    59.  
    60.  
    61.  
    62. 'time step
    63. Dim DeltaT As Single
    64. DeltaT = 0.001 's
    65.  
    66.  
    67. With myPhysics
    68.  
    69.     'generate new coordinates
    70.     .Advance DeltaT
    71.  
    72.  
    73.     'see new coordinates
    74.     With .Bodies(0).Rectangular
    75.         Debug.Print .X
    76.         Debug.Print .Y
    77.     End With
    78.  
    79. End With

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

    Re: DirectPhysics

    I would say, mour, that that looks pretty much exactly how it should work. Perhaps a more general refinement would be to initialise each body at the origin of its own set of local coordinates, and then use coordinate transforms to get from each set to another set or the global, but as an overarching view of things that would look pretty good.

    zaza

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

    Re: DirectPhysics

    Quote Originally Posted by Harsh Gupta
    you mean 2D?? i dont know if 1D objects really exists in this world??
    Yes.. I agree.. Objects are mostly 2D and 3D, But forces are 1D.. Gravity is a downward force.. Acceleretion is a foward force.. Deceleration is a backward force..

    The only force i can think of that may be 2D is rotation.. (or Direction change..)

    Quote Originally Posted by moeur
    Here is how I picture the end product is going to be used. I'f I'm way off base then say so.
    Something like this
    I like how your looking at this..

    This would be where i think working with 1D Force classes could apply..

    we have X, X-Velocity, X-Friction, Mass, X-Acceleration :we can calculate the new X position real time...

    we also have Z, Z-Velocity, Z-Friction, Mass, Z-Acceleration : and can get the New Z position..

    then with Y axis we have Y, Y-Velocity, Y-Friction, Mass, Y-Acceleration, Gravity : and can get the New Y position..

    In this case only the Y axis is affected by gravity.. (Looking at motion on the surface..)

    so all three axis can be calculated by a single 1D function.. Gravity can be set to 0 for X and Z (and for Space flight can be used for X,Y & Z pulls)

    A seperate function can calculate effective gravity according to mass and distance..

    The top levels i'm talking about are our Core Basic functions like E=MCC

    The middle levels should be the functions to do the calculations for the lower levels.

    Gremmy..
    ____________________________________________

  22. #22
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: DirectPhysics

    Yes.. I agree.. Objects are mostly 2D and 3D, But forces are 1D.. Gravity is a downward force.. Acceleretion is a foward force.. Deceleration is a backward force..

    The only force i can think of that may be 2D is rotation.. (or Direction change..)
    Forces are not 1-D, they are all 3-D. Sometimes a problem can be reduced to 2-D or 1-D. For example, consider the force of gravity. As you mentioned near the surface of the earth where the surface can be approximated by a flat surface gravity points in one direction, however once the surface begins to look curved then you need to add another dimension.

    The problem of two bodies can be reduced to 2-D, but add a third and now you need all three dimensions.

    Acceleration, decceleration and rotation are not forces.

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

    Re: DirectPhysics

    I think what he was reffering to is the fact that vertical and horizontal motion are independent. You can therefore right one function for simple projectile motion and call it once for horizontal and once for vertical. The function is therefor a 1-D function. Correct me if I am wrong SAGremlin.
    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

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

    Re: DirectPhysics

    Quote Originally Posted by eyeRmonkey
    I think what he was reffering to is the fact that vertical and horizontal motion are independent. You can therefore right one function for simple projectile motion and call it once for horizontal and once for vertical. The function is therefor a 1-D function. Correct me if I am wrong SAGremlin.
    Thank you .. Some one who understands what i'm saying..


    Quote Originally Posted by moeur
    Acceleration, decceleration and rotation are not forces.
    Actualy they are relative to a applied force.. Acceleration is the Application of a force to increase the relative velocity.. Deceleration is the Application of a force to decrease the relative velocity.. Ratation is a bit more advanced as it has several forces applied is several directions, that causes a circular motion rather than linear motion..

    So for the purpoise of this progect we can look at acceleration as a force. And rotation as multiple forces..

    Also this isn't a Plugin project for Planatary movemnet calculation, it's mostly for 3D game development. Therfore we can assume that all surfaces are flat, and that motion is linear, and not circular..

    All the 3D space games that i've played, had different Graphics engines for surface and space flight, because of the different dynamics.
    Last edited by SAGremlin; Feb 19th, 2006 at 04:30 AM.
    ____________________________________________

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

    Re: DirectPhysics

    can anyone suggest me a good C++ book which can help me in improving my C++ skills, plus helps in coding for this project.

    for this project, i mean if there is a book which exclusively helps in coding in specific area. since most books include definition and explanation of C++ function (basic) but doesnot cover special areas like "Making DLLs in C++", etc.

    sorry, if i confused you, i could not make out how to explain it to you ppl.

    thank you.

    PS: right now i am going through C++ Black book ( :Sigh: Accelerated C++ is not available nowadays), but it doenot cover making DLLs, or making Win32 etc.
    Show Appreciation. Rate Posts.

  26. #26
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: DirectPhysics

    You can therefore right one function for simple projectile motion and call it once for horizontal and once for vertical
    you can always break down each vector into 2 horizontal and one vertical components if that is what you mean, but no one would call it a 1-d problem.

    I think what SA was saying is that he is only concerned with situations where gravity is always pointing along one of those components (vertical) and doesn't think we should worry about the rest (i.e. ballistic missles, rocket ships and planets).

    SA,

    I know you understand force and acceleration, but let's not start confusing people by calling things by the wrong name. Acceleration is the result you get when you apply a force to a mass.

    A constant rotation is an angular velocity and does not require force. An angular acceleration, on the otherhand, is the product of a force applied to a mass.

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

    Cool Re: DirectPhysics

    Quote Originally Posted by moeur
    you can always break down each vector into 2 horizontal and one vertical components if that is what you mean, but no one would call it a 1-d problem.
    But you could use the same 1D function to calculate each vector component. Thus you need 1/3rd of the code, making it easier to debug and tweek..

    Quote Originally Posted by moeur
    I think what SA was saying is that he is only concerned with situations where gravity is always pointing along one of those components (vertical) and doesn't think we should worry about the rest (i.e. ballistic missles, rocket ships and planets).
    Correct..

    Quote Originally Posted by moeur
    I know you understand force and acceleration, but let's not start confusing people by calling things by the wrong name. Acceleration is the result you get when you apply a force to a mass.
    Okay..

    Quote Originally Posted by moeur
    A constant rotation is an angular velocity and does not require force. An angular acceleration, on the otherhand, is the product of a force applied to a mass.
    This is very true.. But you need to apply forces to the object to get the rotation, we need to consider this because we need to be able to calculate the angular velocity and angular rotation..

    I must appologise too.. I last used physics almost 15 years ago, and have forgotten alot of the correct terms, but I remember the theory and maths behind it all..

    I'va already stated digging out alot of my old theory books to keep around as handy reference..
    ____________________________________________

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

    Re: DirectPhysics

    Quote Originally Posted by SAGremlin
    Also this isn't a Plugin project for Planatary movemnet calculation, it's mostly for 3D game development. Therfore we can assume that all surfaces are flat, and that motion is linear, and not circular..
    To chip in some more cents worth, I really think that this would be a bad way to go, for a number of reasons.

    1) There are plenty of people who would like to see such stuff included. FPS games are not the only 3D games out there, nor are games the only uses for 3D modelling.

    2) Things such as gravity are simply specifics of a generalised force. Once a "force" calc is implemented, then it just needs a magnitude and a direction. I appreciate your point made earlier about keeping the calculations fast, but doing this by restricting so severely what the user can do is, in my opinion, definitely not the way to go. Of course there have to be limits, but they can be further out than this.

    3) Sticking to linear motion and ignoring angular motion would be disaster! Nobody would want to use the engine.

    4) This may, in fact, complicate things. Here is an example:

    Suppose I wanted to model a juggler, moving balls around in a circle. In cartesian (XYZ) coordinates, I would need to apply exactly the correct force in moving the jugglers left hand, just the right amount of compensatory force to his right hand, offset against gravity and hope that the resultant calculation would move the balls around in a circle, rather as though he were holding two table-tennis bats and just bouncing the balls. To actually work out the starting parameters to script something like this would be a nightmare and I suspect that most of the attempts to get it to go would end up with balls flying off everywhere. This will be a major problem in all these circumstances where complex motion is involved. I recall JR's problems just getting linear friction to work on his SF2 game...
    Alternatively, one could just put the balls in their own frame of reference using cylindrical polars with no z-axis movement. No force calc would be necessary, because the balls would move at steady angular velocity, and a separation of 1mm between balls and juggler hands would ensure that the hands didn't interfere whilst looking to the user as though they were causing the juggling. This would be significantly easier for the user to implement, as well as actually being quicker to calculate.

    I suspect that, for such a situation, one would simply have to accept that DirectPhysics could not handle the challenge or that at best it would be rather complicated, when in fact a different programming approach would make it very easy.

    But you could use the same 1D function to calculate each vector component. Thus you need 1/3rd of the code, making it easier to debug and tweek..
    Of course, I have chosen a scenario which fits my argument, but if this is to actually be a useful piece of programming then it would be better not to restrict what the user can do or make things overly complicated just for the sake of making the coding of the engine easier.
    But I maintain that allowing different coordinate systems to be used, implementing a single (or multiple) "Force" object in that coordinate system (whatever it should happen to be) and then applying a characteristic(s) such as "Gravitational" or "Magnetic" to the force object(s) would be an infinitely more useful and in no way more difficult road to take. This is what moeur suggested above.


    zaza
    Last edited by zaza; Feb 19th, 2006 at 03:48 PM.

  29. #29

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by moeur
    I agree with zaza about where we should start. However we still need to decide what the end product is going to look like so that we can work toward that goal.

    Here is how I picture the end product is going to be used. I'f I'm way off base then say so.
    Something like this
    VB Code:
    1. Dim myPhysics As clsDirectPhysics
    2. Set myPhysics = New clsDirectPhysics
    3.  
    4. 'add bodies
    5. Dim myBody As clsDPBody
    6. Set myBody = New clsDPBody
    7.  
    8. With myBody
    9.     .Mass = 10 'kg
    10. 'set initial coordinates and velocity
    11.     With .Rectangular
    12.         .X = 100000 'm
    13.         .Y = 200000 'm
    14.         .Z = 0 'm
    15.         .Vx = 1000 'm/s
    16.         .Vy = 500 'm/s
    17.         .Vz = 0
    18.     End With
    19.  
    20. 'Alternatively we could use spherical or cylindrical coordiantes
    21.     With .Spherical
    22.         .Radius = 223607 'm
    23.         .Theta = 0.463 'radians
    24.         .phi = 0
    25.     End With
    26.  
    27. End With
    28. myPhysics.Bodies.Add myBody
    29.  
    30. With myBody
    31.     .Mass = 1000000 'kg
    32. 'set initial coordinates and velocity
    33.     With .Rectangular
    34.         .X = 0
    35.         .Y = 0
    36.         .Z = 0
    37.         .Vx = 0 'm/s
    38.         .Vy = 0 'm/s
    39.         .Vz = 0
    40.     End With
    41. End With
    42. myPhysics.Bodies.Add myBody
    43.  
    44.  
    45. 'use a gravitational force
    46. Dim Force1 As clsGravity
    47. Set Force1 = New clsGravity
    48.  
    49. myPhysics.Forces.Add Force1
    50. Set Force1 = Nothing
    51.  
    52. 'add a frictional force
    53. Dim Force2 As clsFriction
    54. Set Force2 = New clsFriction
    55. Force2.Coeffecient = 0.5
    56.  
    57. myPhysics.Forces.Add Force2
    58. Set Force2 = Nothing
    59.  
    60.  
    61.  
    62. 'time step
    63. Dim DeltaT As Single
    64. DeltaT = 0.001 's
    65.  
    66.  
    67. With myPhysics
    68.  
    69.     'generate new coordinates
    70.     .Advance DeltaT
    71.  
    72.  
    73.     'see new coordinates
    74.     With .Bodies(0).Rectangular
    75.         Debug.Print .X
    76.         Debug.Print .Y
    77.     End With
    78.  
    79. End With

    It would look something like that, only with a DirectX style of syntax, which is where me and damasterjo will come in and sort out.

    I'll be back to respond to the other posts. Got to get back to work.

  30. #30
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: DirectPhysics

    Nobody is working because our supervisor has not clarified what classes we need and what we are working on.

  31. #31

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by zaza
    If I may make a suggestion.

    First of all, sort out some kind of core package to deal with vectors. Include vector sums, dot products, cross products, transpose, adjoint, jacobians , grad, and anthing else you can think of. Matrices would also be useful.
    You really won't regret it, because the last thing you want is lots of different people doing vector algebra in different ways. Get this sorted at the beginning, and the rest will just plug into it.


    zaza

    There will be a Math class in DirectPhysics that will contain math done to vectors and matrices.

  32. #32

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by moeur
    Nobody is working because our supervisor has not clarified what classes we need and what we are working on.
    Damn gotta go back to work. When it's lunch time, I shall show you all the classes we need to create.

  33. #33

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Moeur, bear in mind you are also a project director, so you can help design the classes too.

    Anyways, there's only some I can think of to create at the moment, but while we work on the project, you better believe others will be added. Here are the 7 that I thought of:

    DPForce - This will calculate all of the forces applied to an object in both 2D/3D, add them up, and return the result in the Net Force.

    DPSprite - This will contain some important info for a 2D/3D sprite, such as the Position, Velocity, Acceleration, Force, Mass, etc.

    DPIntegration - This will contain a number of time based integration technics the user can choose from, such as Euler, Backwards Euler, Runge Kutta 4, Verlet, LeapFrog, etc.

    DPRigidBody - This will contain all the functions needed to produce rigid body physics.

    DPCollision - This will contain a number of different methods to test for collision for 2D/3D polygons.

    DPRagdoll - Not sure if a class is needed for this, but this class will contain functions needed to produce ragdoll physics.

    DPMath - This will contain some useful math functions needed for Vector math, Matrix math, Quaternions, etc., and contain some very handy constants.

    And all of these classes will be a part of the main class, DirectPhysics. If anybody has any comments on any of these classes, or ideas for others, let me know.

  34. #34
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: DirectPhysics

    OK, let's see if I understand this.
    the DirectPhysics class will contain
    a collection of Sprites of type DPSprite
    Each sprite will contain:
    mass - scalar
    Position - 3-d point
    Acceleration - Vector
    Velocity - Vector
    Forces - collection of Vectors for local forces
    NetForce - Vector
    There is also a global collection of force vectors that apply to all sprites.

    So to move the animation forward by one timestep we use the DPIntegration method which updates all the data in all the sprites?

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

    Re: DirectPhysics

    I agree with what moeur said before about acceleration not being a force. If net force is equal to zero then the object is still. If the net force is not equal to zero then there is some for of acceleration or decceleration (properly called negative acceleration).
    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

  36. #36
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: DirectPhysics

    Quote Originally Posted by moeur
    OK, let's see if I understand this.
    the DirectPhysics class will contain
    a collection of Sprites of type DPSprite
    Each sprite will contain:
    mass - scalar
    Position - 3-d point
    Acceleration - Vector
    Velocity - Vector
    Forces - collection of Vectors for local forces
    NetForce - Vector
    There is also a global collection of force vectors that apply to all sprites.

    So to move the animation forward by one timestep we use the DPIntegration method which updates all the data in all the sprites?
    That's sounds fine. I want to add that we should be very carefull about where and when each force would be applied, I think the best is giving the user a full control over that. In most games, the user player is still in the center of the screen, no real movement applied (I'm talking about his movement according to scene, not his own inner movement, like moving his hands). In this cases, the movement effect is done by applying reverse player speed to the global scene, so, maybe the DPIntegration should update all sprites except the player sprite, all the other players will be moved by DPIntegration and by its own speeds.
    I'm talking just about an example about an implementation, for instances, a soccer game:
    The BALL sprite, would be always in the center of the screen, no real movement, all ball movement would be applied in reverse to the whole scene, so, but when a player has the ball, he is also still there, no movement for him, but all the other players should be moved with the scene.
    So, I think that we could add 1 more property to the DPsprite class that would say if a DPsprite must be affected by the global/scene/camera movement or not. Or that should be done by the user himself?

  37. #37

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by moeur
    OK, let's see if I understand this.
    the DirectPhysics class will contain
    a collection of Sprites of type DPSprite
    Each sprite will contain:
    mass - scalar
    Position - 3-d point
    Acceleration - Vector
    Velocity - Vector
    Forces - collection of Vectors for local forces
    NetForce - Vector
    There is also a global collection of force vectors that apply to all sprites.

    So to move the animation forward by one timestep we use the DPIntegration method which updates all the data in all the sprites?
    DPIntegration is a class, not a method, but there will be a method in the DPIntegration class that will update all the physics data. Guess we can call it .Update, which will be similar to Direct3D's .Present method.

  38. #38

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by eyeRmonkey
    I agree with what moeur said before about acceleration not being a force. If net force is equal to zero then the object is still. If the net force is not equal to zero then there is some for of acceleration or decceleration (properly called negative acceleration).
    You're right, acceleration is NOT a force. It is a vector that represents a change in velocity.

  39. #39

    Thread Starter
    Android OpenGL ES Guru Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,278

    Re: DirectPhysics

    Quote Originally Posted by jcis
    That's sounds fine. I want to add that we should be very carefull about where and when each force would be applied, I think the best is giving the user a full control over that. In most games, the user player is still in the center of the screen, no real movement applied (I'm talking about his movement according to scene, not his own inner movement, like moving his hands). In this cases, the movement effect is done by applying reverse player speed to the global scene, so, maybe the DPIntegration should update all sprites except the player sprite, all the other players will be moved by DPIntegration and by its own speeds.
    I'm talking just about an example about an implementation, for instances, a soccer game:
    The BALL sprite, would be always in the center of the screen, no real movement, all ball movement would be applied in reverse to the whole scene, so, but when a player has the ball, he is also still there, no movement for him, but all the other players should be moved with the scene.
    So, I think that we could add 1 more property to the DPsprite class that would say if a DPsprite must be affected by the global/scene/camera movement or not. Or that should be done by the user himself?
    I think it might be best to have both methods, but for many sprites, you would need to create a buffer, so that 1 update call can update all the sprites data in memory. Similar to Direct3D's method that's done to polygons.

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

    Re: DirectPhysics

    Quote Originally Posted by Jacob Roman
    You're right, acceleration is NOT a force. It is a vector that represents a change in velocity.
    Okay Now that we done Ragging Gremmy for his terible memory..

    lets get this on a roll... I'm liking what you got going there... Give us more...

    Gremmy..
    ____________________________________________

Page 1 of 2 12 LastLast

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width