April 28, 2024, 04:40:49 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Newton Physics...

Started by J B Wood (Zumwalt), September 03, 2006, 08:16:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

J B Wood (Zumwalt)

Ok, other than ODE, I wanted to start simple (ODE has over 600 routines, Newton has less than 300)
Ok, so it has no DEF file for me to look at, so I did an export to a DEF:


Microsoft (R) COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file newton.dll

File Type: DLL

  Section contains the following exports for Newton.dll

    00000000 characteristics
    44753364 time date stamp Thu May 25 00:32:36 2006
        0.00 version
           1 ordinal base
         229 number of functions
         229 number of names

    ordinal hint RVA      name

          1    0 00003AA0 NewtonAddBodyImpulse
          2    1 00001A60 NewtonBallGetJointAngle
          3    2 00001AC0 NewtonBallGetJointForce
          4    3 00001A90 NewtonBallGetJointOmega
          5    4 00003B50 NewtonBallSetConeLimits
          6    5 00001A50 NewtonBallSetUserCallback
          7    6 00003340 NewtonBodyAddBuoyancyForce
          8    7 000052C0 NewtonBodyAddForce
          9    8 00005360 NewtonBodyAddTorque
         10    9 00003470 NewtonBodyCoriolisForcesMode
         11    A 00003A30 NewtonBodyForEachPolygonDo
         12    B 000038B0 NewtonBodyGetAABB
         13    C 000054A0 NewtonBodyGetAngularDamping
         14    D 00003850 NewtonBodyGetAutoFreeze
         15    E 00003290 NewtonBodyGetCentreOfMass
         16    F 000034A0 NewtonBodyGetCollision
         17   10 000037B0 NewtonBodyGetContinuousCollisionMode
         18   11 00003160 NewtonBodyGetForce
         19   12 00002C20 NewtonBodyGetForceAndTorqueCallback
         20   13 00003870 NewtonBodyGetFreezeTreshold
         21   14 00002E20 NewtonBodyGetInvMass
         22   15 00003800 NewtonBodyGetJointRecursiveCollision
         23   16 00003A10 NewtonBodyGetLinearDamping
         24   17 00002DB0 NewtonBodyGetMassMatrix
         25   18 000034C0 NewtonBodyGetMaterialGroupID
         26   19 00003100 NewtonBodyGetMatrix
         27   1A 000039D0 NewtonBodyGetOmega
         28   1B 00003860 NewtonBodyGetSleepingState
         29   1C 00003250 NewtonBodyGetTorque
         30   1D 00002BB0 NewtonBodyGetUserData
         31   1E 00003950 NewtonBodyGetVelocity
         32   1F 00002BC0 NewtonBodyGetWorld
         33   20 00005460 NewtonBodySetAngularDamping
         34   21 00003820 NewtonBodySetAutoFreeze
         35   22 00002BE0 NewtonBodySetAutoactiveCallback
         36   23 00005320 NewtonBodySetCentreOfMass
         37   24 00001A40 NewtonBodySetCollision
         38   25 00003780 NewtonBodySetContinuousCollisionMode
         39   26 00002C30 NewtonBodySetDestructorCallback
         40   27 00003120 NewtonBodySetForce
         41   28 00002C10 NewtonBodySetForceAndTorqueCallback
         42   29 000053C0 NewtonBodySetFreezeTreshold
         43   2A 000037D0 NewtonBodySetJointRecursiveCollision
         44   2B 00005400 NewtonBodySetLinearDamping
         45   2C 00002C40 NewtonBodySetMassMatrix
         46   2D 000034B0 NewtonBodySetMaterialGroupID
         47   2E 00002EB0 NewtonBodySetMatrix
         48   2F 000030C0 NewtonBodySetMatrixRecursive
         49   30 00003990 NewtonBodySetOmega
         50   31 000031A0 NewtonBodySetTorque
         51   32 00002BD0 NewtonBodySetTransformCallback
         52   33 00002BA0 NewtonBodySetUserData
         53   34 00003910 NewtonBodySetVelocity
         54   35 00002B50 NewtonCollisionCalculateAABB
         55   36 00001850 NewtonCollisionClosestPoint
         56   37 00001880 NewtonCollisionCollide
         57   38 000018C0 NewtonCollisionCollideContinue
         58   39 00001950 NewtonCollisionMakeUnique
         59   3A 00001820 NewtonCollisionPointDistance
         60   3B 00005100 NewtonCollisionRayCast
         61   3C 00003B00 NewtonConstraintCreateBall
         62   3D 000041C0 NewtonConstraintCreateCorkscrew
         63   3E 00004020 NewtonConstraintCreateHinge
         64   3F 00004150 NewtonConstraintCreateSlider
         65   40 00004230 NewtonConstraintCreateUniversal
         66   41 000042C0 NewtonConstraintCreateUpVector
         67   42 00001CC0 NewtonConstraintCreateUserJoint
         68   43 00004590 NewtonConstraintCreateVehicle
         69   44 000016F0 NewtonConvexCollisionCalculateInertialMatrix
         70   45 000016E0 NewtonConvexCollisionCalculateVolume
         71   46 000016D0 NewtonConvexCollisionGetUserID
         72   47 000016A0 NewtonConvexCollisionSetUserID
         73   48 00001640 NewtonConvexHullModifierGetMatrix
         74   49 00001670 NewtonConvexHullModifierSetMatrix
         75   4A 00001C10 NewtonCorkscrewCalculateStopAccel
         76   4B 00001BF0 NewtonCorkscrewCalculateStopAlpha
         77   4C 00001B60 NewtonCorkscrewGetJointAngle
         78   4D 00001C60 NewtonCorkscrewGetJointForce
         79   4E 00001AF0 NewtonCorkscrewGetJointOmega
         80   4F 00001BE0 NewtonCorkscrewGetJointPosit
         81   50 00001B70 NewtonCorkscrewGetJointVeloc
         82   51 00001BD0 NewtonCorkscrewSetUserCallback
         83   52 00005530 NewtonCreate
         84   53 000019A0 NewtonCreateBody
         85   54 00001320 NewtonCreateBox
         86   55 000014F0 NewtonCreateCapsule
         87   56 00001590 NewtonCreateChamferCylinder
         88   57 00001680 NewtonCreateCompoundCollision
         89   58 000014A0 NewtonCreateCone
         90   59 000015E0 NewtonCreateConvexHull
         91   5A 00001630 NewtonCreateConvexHullModifier
         92   5B 00001540 NewtonCreateCylinder
         93   5C 00001310 NewtonCreateNull
         94   5D 00001DF0 NewtonCreateRagDoll
         95   5E 00001370 NewtonCreateSphere
         96   5F 00001710 NewtonCreateTreeCollision
         97   60 00005080 NewtonCreateTreeCollisionFromSerialization
         98   61 00004F70 NewtonCreateUserMeshCollision
         99   62 00002280 NewtonDestroy
        100   63 000055E0 NewtonDestroyAllBodies
        101   64 000019B0 NewtonDestroyBody
        102   65 00001DE0 NewtonDestroyJoint
        103   66 00001E10 NewtonDestroyRagDoll
        104   67 00001970 NewtonGetEulerAngle
        105   68 00001030 NewtonGetTimeStep
        106   69 00001B00 NewtonHingeCalculateStopAlpha
        107   6A 00001B60 NewtonHingeGetJointAngle
        108   6B 00001B20 NewtonHingeGetJointForce
        109   6C 00001AF0 NewtonHingeGetJointOmega
        110   6D 00001B50 NewtonHingeSetUserCallback
        111   6E 00004420 NewtonJointGetCollisionState
        112   6F 00001DC0 NewtonJointGetStiffness
        113   70 00001DA0 NewtonJointGetUserData
        114   71 00004400 NewtonJointSetCollisionState
        115   72 00001DD0 NewtonJointSetDestructor
        116   73 00001DB0 NewtonJointSetStiffness
        117   74 00001D90 NewtonJointSetUserData
        118   75 00004DF0 NewtonMaterialContactRotateTangentDirections
        119   76 000010B0 NewtonMaterialCreateGroupID
        120   77 000010C0 NewtonMaterialDestroyAllGroupID
        121   78 00001180 NewtonMaterialDisableContact
        122   79 00001210 NewtonMaterialGetBodyCollisionID
        123   7A 000011A0 NewtonMaterialGetContactFaceAttribute
        124   7B 00002830 NewtonMaterialGetContactForce
        125   7C 000025F0 NewtonMaterialGetContactNormalSpeed
        126   7D 000011B0 NewtonMaterialGetContactPositionAndNormal
        127   7E 000011E0 NewtonMaterialGetContactTangentDirections
        128   7F 00004B70 NewtonMaterialGetContactTangentSpeed
        129   80 000025D0 NewtonMaterialGetCurrentTimestep
        130   81 000010A0 NewtonMaterialGetDefaultGroupID
        131   82 00001190 NewtonMaterialGetMaterialPairUserData
        132   83 00001140 NewtonMaterialGetUserData
        133   84 00002590 NewtonMaterialSetCollisionCallback
        134   85 00002990 NewtonMaterialSetContactElasticity
        135   86 00001260 NewtonMaterialSetContactFrictionState
        136   87 00002A80 NewtonMaterialSetContactKineticFrictionCoef
        137   88 000012B0 NewtonMaterialSetContactNormalAcceleration
        138   89 00004DE0 NewtonMaterialSetContactNormalDirection
        139   8A 00002930 NewtonMaterialSetContactSoftness
        140   8B 000029F0 NewtonMaterialSetContactStaticFrictionCoef
        141   8C 000012D0 NewtonMaterialSetContactTangentAcceleration
        142   8D 00001100 NewtonMaterialSetContinuousCollisionMode
        143   8E 000010D0 NewtonMaterialSetDefaultCollidable
        144   8F 000024D0 NewtonMaterialSetDefaultElasticity
        145   90 000023E0 NewtonMaterialSetDefaultFriction
        146   91 00002530 NewtonMaterialSetDefaultSoftness
        147   92 00004430 NewtonRagDollAddBone
        148   93 00001E30 NewtonRagDollBegin
        149   94 00001EA0 NewtonRagDollBoneGetBody
        150   95 00001EE0 NewtonRagDollBoneGetGlobalMatrix
        151   96 00001EB0 NewtonRagDollBoneGetLocalMatrix
        152   97 00001E50 NewtonRagDollBoneGetUserData
        153   98 00001E80 NewtonRagDollBoneSetID
        154   99 00004490 NewtonRagDollBoneSetLimits
        155   9A 00001E40 NewtonRagDollEnd
        156   9B 00001E90 NewtonRagDollFindBone
        157   9C 00001E70 NewtonRagDollSetForceAndTorqueCallback
        158   9D 00001E60 NewtonRagDollSetTransformCallback
        159   9E 00001960 NewtonReleaseCollision
        160   9F 00001040 NewtonSetBodyLeaveWorldEvent
        161   A0 00005200 NewtonSetEulerAngle
        162   A1 00001020 NewtonSetFrictionModel
        163   A2 00002380 NewtonSetMinimumFrameRate
        164   A3 00001000 NewtonSetPlatformArchitecture
        165   A4 00001010 NewtonSetSolverModel
        166   A5 000049D0 NewtonSetWorldSize
        167   A6 00001B80 NewtonSliderCalculateStopAccel
        168   A7 00001BA0 NewtonSliderGetJointForce
        169   A8 00001B60 NewtonSliderGetJointPosit
        170   A9 00001B70 NewtonSliderGetJointVeloc
        171   AA 00001B50 NewtonSliderSetUserCallback
        172   AB 00001790 NewtonTreeCollisionAddFace
        173   AC 00001750 NewtonTreeCollisionBeginBuild
        174   AD 00004FF0 NewtonTreeCollisionEndBuild
        175   AE 00002B10 NewtonTreeCollisionGetFaceAtribute
        176   AF 00001800 NewtonTreeCollisionSerialize
        177   B0 00002B30 NewtonTreeCollisionSetFaceAtribute
        178   B1 00001BF0 NewtonUniversalCalculateStopAlpha0
        179   B2 00001C40 NewtonUniversalCalculateStopAlpha1
        180   B3 00001B60 NewtonUniversalGetJointAngle0
        181   B4 00001BE0 NewtonUniversalGetJointAngle1
        182   B5 00001C60 NewtonUniversalGetJointForce
        183   B6 00001AF0 NewtonUniversalGetJointOmega0
        184   B7 00001C30 NewtonUniversalGetJointOmega1
        185   B8 00001BD0 NewtonUniversalSetUserCallback
        186   B9 00001C90 NewtonUpVectorGetPin
        187   BA 00004300 NewtonUpVectorSetPin
        188   BB 000022C0 NewtonUpdate
        189   BC 000043C0 NewtonUserJointAddAngularRow
        190   BD 00001D00 NewtonUserJointAddGeneralRow
        191   BE 00004340 NewtonUserJointAddLinearRow
        192   BF 00001D80 NewtonUserJointGetRowForce
        193   C0 00001D40 NewtonUserJointSetRowAcceleration
        194   C1 00001D20 NewtonUserJointSetRowMaximumFriction
        195   C2 00001D30 NewtonUserJointSetRowMinimumFriction
        196   C3 00001D50 NewtonUserJointSetRowSpringDamperAcceleration
        197   C4 00001D70 NewtonUserJointSetRowStiffness
        198   C5 000045D0 NewtonVehicleAddTire
        199   C6 000054D0 NewtonVehicleGetFirstTireID
        200   C7 00004690 NewtonVehicleGetNextTireID
        201   C8 00004760 NewtonVehicleGetTireLateralSpeed
        202   C9 00004770 NewtonVehicleGetTireLongitudinalSpeed
        203   CA 00001F40 NewtonVehicleGetTireMatrix
        204   CB 000054E0 NewtonVehicleGetTireNormalLoad
        205   CC 000046E0 NewtonVehicleGetTireOmega
        206   CD 000046B0 NewtonVehicleGetTireSteerAngle
        207   CE 000046A0 NewtonVehicleGetTireUserData
        208   CF 00001F30 NewtonVehicleRemoveTire
        209   D0 00001F20 NewtonVehicleReset
        210   D1 00001F10 NewtonVehicleSetTireCallback
        211   D2 000047E0 NewtonVehicleSetTireLongitudinalSlideCoeficient
        212   D3 000047C0 NewtonVehicleSetTireMaxLongitudinalSlideSpeed
        213   D4 00004780 NewtonVehicleSetTireMaxSideSleepSpeed
        214   D5 000047A0 NewtonVehicleSetTireSideSleepCoeficient
        215   D6 00001F60 NewtonVehicleSetTireSteerAngle
        216   D7 000046D0 NewtonVehicleSetTireTorque
        217   D8 00004740 NewtonVehicleTireCalculateMaxBrakeAcceleration
        218   D9 00004800 NewtonVehicleTireIsAirBorne
        219   DA 00004820 NewtonVehicleTireLostSideGrip
        220   DB 00004840 NewtonVehicleTireLostTraction
        221   DC 00004700 NewtonVehicleTireSetBrakeAcceleration
        222   DD 00004A30 NewtonWorldForEachBodyDo
        223   DE 00004A80 NewtonWorldForEachBodyInAABBDo
        224   DF 00001050 NewtonWorldFreezeBody
        225   E0 00001090 NewtonWorldGetUserData
        226   E1 00001070 NewtonWorldGetVersion
        227   E2 00004AF0 NewtonWorldRayCast
        228   E3 00001080 NewtonWorldSetUserData
        229   E4 00001060 NewtonWorldUnfreezeBody

  Summary

        6000 .data
        9000 .rdata
        3000 .reloc
       5E000 .text




Here is my problem, I know there in's and out's, kinda, but

NewtonCreate
NewtonDestroy

For the begining, I tried:


declare cdecl import, NewtonCreate(string *malloc,string *free),string;
declare cdecl import, NewtonDestroy(string *world);


but I get an error with
Unresolved external __imp_NewtonCreate

Any suggestions? I'll convert newton if I can get help on this.

Ionic Wind Support Team

Did you create the import library? (from the tools menu)
Ionic Wind Support Team

J B Wood (Zumwalt)

September 03, 2006, 08:39:00 PM #2 Last Edit: September 03, 2006, 08:40:56 PM by zumwalt
In C or in Aurora.. looking...
*grins* just now did, I was using there LIB file, I didn't think of using the import library thing...
I didn't get an error!
going to setup the destroy object and see if that helps.
I'll let you know if I get stuck again, they use alot of custom objects.

J B Wood (Zumwalt)

That won't work on rakknet.dll though.
It worked fine on Newton.
I'll hammer on this some and see if I can get a basic routine working with Newton.
It will sit in with my tank game as I make it.

Ionic Wind Support Team

What didn't work on rakknet.dll?
Ionic Wind Support Team

kryton9

Don't mean to interfere in the dialog, but sort of lost as to what is happening? Zumwalt are you writing some sort of way for us to use Newton Physics with Aurora?

Ionic Wind Support Team

Yes that is what he is doing.
Ionic Wind Support Team

kryton9

Cool, I guess I should check into Newton and see what all it offers... things are progressing quickly, lots to keep up and to learn, love it!!

J B Wood (Zumwalt)

September 04, 2006, 08:44:36 AM #8 Last Edit: September 04, 2006, 08:47:09 AM by zumwalt
When I download Rakknet, and take the DLL from the distribution folder, place it in the project folder of my project, then use the Tools / Create Import Library, it errors and it unable to create an import library.

My tank project includes both the Rakknet dll and the Newton dll in its base folder, you can give it a go yourself to see what I mean.
Right now for my Newton calls, I keep crashing the program, I am passing stuff wrong probably, looking into it deeper.
It wants the pointer to the "world" which I figured was a pointer to the 'scene', but that blows up.
I'll keep hammering on it before I bug you Paul, this is more like a 6 month project for me and I want to fully understand the method calls.
I think one main problem I have right now is that I don't have all of the global structures to Newton defined, trying to find them.

Ironically, I know it will work once I get past this point because newtoncreate and newtondestroy are working.


EDIT:
LOL.. ok the world is the int passed back from the NewtonCreate command.
I am such an idiot. I need to sleep more often and drink less than 10 pots of cofee before bed.

J B Wood (Zumwalt)

For those watching this thread, I have succesfully initiated the Newton engine in Aurora and added objects to the Newton generated world, I am now learning the relationship between the Aurora mesh objects and the Newton objects. Once I get that figured out, hopefully my generic gravity will then be replaced with Newton gravity.

This is not an overnight process since today was the second day I have ever touched Newton.
Although today being a holiday wife will drag me out of the house so don't expect maricles on this day form me :)

kryton9

That's cool zumwalt. Take your time, I know I got enough to study and work on for now. But, having those features will be great when they are finished.

Just to learn what you and how you are doing what you are doing, I don't expect a long detailed answer as I know you are just starting on it.

But, what are the steps you took so far?

1. know which dll to use
2. see inside of that dll
3. then make even 1 command work in Aurora

Enjoy the day out. I need to do chores I have been putting off for over 2 weeks, but my mind will be on Aurora while I am doing the other stuff.

J B Wood (Zumwalt)

First, I visited: http://www.physicsengine.com/

From there I downloaded the SDK for windows, verwion 1.53 and installed it. The install placed the files under:
C:\Program Files\NewtonSDK

In that folder, there is a SDK folder with a DLL folder inside it.
I copied the DLL from inside the DLL folder and placed it in the root of my Aurora3D projects folder.
Once I opened up Aurora and my project, I then clicked on Tools, Create Import Library and chose the Newton.dll that was in my project folder.
This created the newton.lib file I needed to work with.

Now, working with someone elses dll, you need to know about the IN's and OUT's of the methods, along with there names.
This is usually taken from some sort of instructions given by the developer of the dll.
In this case, what scarse information I have to work with is located in there help file, and it is scarse.

It lacks alot of primary information, like structures, global variables and such, but playing with the methods and learning what they really are doing will help in determining how and what to write to make them work.

To keep this short, I'll just cover 2 methods here, although at this time I have 20 or so already done.
To call an external DLL, you have to call its corosponding LIB file, so in my INC file that I created calling it newton.inc, I do a call to the lib with
#USE "Newton.LIB"
(syntax is not important in the quotes)

Now in my code to use the 2 main methods of Newton, (very important to use them I am certain of)

declare cdecl import, NewtonCreate(string *malloc,string *free),int;
declare cdecl import, NewtonDestroy(int world);


Now, what I don't know for sure is the two initial pointers for NewtonCreate, but if you pass them both a 0, it assumes default, these are supposed to be pointers to memory locations, but right now I don't know why, I haven't gotten that far.

What NewtonCreate does, is that it creates a 'world' that all physics will work in, this is a shell that wraps around your 3d world and encompases it for a lack of better terms.

This method works and returns to me a pointer to the world object.
When I am done with my application and exit form the do while loop for the game itself, I then terminate the world through NewtonDestroy(world) passing it the world pointer that is created in the begining.

This is typical of any external call in aurora. You have to know the name of the method and its values that are for both input and output to correctly use the public method.

There is the key to everything, the only methods on a DLL you can use are any publicly declared methods, methods that are private will not be available to use, and generally there is a purpose for that.

Hopefully this helps to understand the chaos that is me :)

kryton9

Thanks for your efforts, I am sure it is hair pulling time. Good luck and thanks for your efforst again!!

Todd Riggins

This sounds pretty cool zumwalt! eagerly looking forward to see how it turns out  ;D
Brought to you buy: http://www.exodev.com

J B Wood (Zumwalt)

Thanks, hopefully I can get over a few hurdles, but once I do, its smooth sailing.
I think I need to shoot the makers of Newton a quick email with questions though.
Undocumented global declarations is killing my efforts.

J B Wood (Zumwalt)

Trial 1, call this an alpha I guess.
No code to demonstrate it, its just the INC I have created.
You need newton 1.53 and create the lib import for to use it.


kryton9

September 05, 2006, 05:27:21 PM #16 Last Edit: September 05, 2006, 08:09:16 PM by kryton9
Downloaded the include file. Thanks for the efforts Zumwalt. Will take a look at what is available. I haven't downloaded Newton yet, Thanks again, as I know that has got to be quite an undertaking!

edited:Wow just looked through the include, that is lots of stuff you are figuring out Z, going to be really cool to have, thanks again!

J B Wood (Zumwalt)

RenderPrimitive Initial conversion.
Meat to bones to be added later.


J B Wood (Zumwalt)

Its just translating K.
Thanks though, couldn't do this without the help of Paul and the gang.
I have a ton more to do before I can fully display what this is doing.
I hope to have the tank demo updated with Newton either by this weekend or next.
As you can see from the latest build, I do initialize newton and do a few tests with it, but nothing visual yet. (that is in game)

kryton9

Looking good, still over my head at the moment, glad you are tackling it!!

ExMember001

looking good Zumwalt ;)
will be interresting to see that in action!

kryton9

I get an error when trying to make the raknet library from the raknet.dll. Did you have this problem Z?

J B Wood (Zumwalt)

Yes.
Place these in your Aurora Libs folder.
That will get rid of that error.
Aurora can't translate them using the makelib function.

(rather unzip this and place the 2 libs into your libs folder)

J B Wood (Zumwalt)

I have 12 header files and 8 cpp files to translate before I can build the demo up the way it needs done.
Once they are done, they are what the newton crew calls the 'toolbox', these are the list of methods you need in order to fully utilize the library.
Although you can use the library without the tools, the tools make it easier.
Once they are finished, I'll be posting them in a toolbox zip, and you will need to create a folder called toolbox in your aurora project folder where you have a project, and then the newton.inc will also inherit from a newtontool.inc, which will include all of those tools in the subfolder.

That said, your project will only need to do an include on the newton.inc, then you can fully utilize the newton engine.
If anyone has used Newton before and written a very very very simple project using the most basic components, please chime in.
Maybe you can take the include I have written already and write a 1 page of code application to show it in use.

kryton9

September 06, 2006, 03:42:25 PM #24 Last Edit: September 06, 2006, 03:44:10 PM by kryton9
Thanks Z, I will look for projects, I know guys have written stuff using it with DarkBasic Pro. I can see if I understand any and make a similar translation for Aurora. Will be a great way for me to get into it quickly. Will get to it this weekend, as got a few other things I want to wrap up this week. Thanks.

Cool your latest build went fine now with those libs :)