Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / A simple Newton Physics Tutorial

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 21st Jan 2008 22:26
well, all my attempts of integrating this newton thing gets stuck at a point that i think im making somethin wrong but dunno what...
So, does anyone have a working project to show me how it is simply done? Like forexample the very first demo?
Windsept
18
Years of Service
User Offline
Joined: 9th Jun 2006
Location: United States
Posted: 21st Jan 2008 23:10
Here is the first demo from the newton download. Hope this is what you want!!

Windsept

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 21st Jan 2008 23:32
That was very kind of you to post that code, however i am looking for a newton implementation on DarkGDK not DBPro.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Jan 2008 19:13
Noone has ever really done any simple stuff with Newton yet?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 22nd Jan 2008 19:15
Arent there examples with the Newton SDK?

Your signature has been erased by a mod
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Jan 2008 19:26
Oh my, yes genius there are, but what i told in my first post is all my efforts of integrating it with DarkGDK have been useless and i got stucked.
So i thought probably im doing the whole thing wrong and maybe some generous guy will teach me how it is done exactly.

No offence Mr.Zotoaster but if you havent even tried it yourself which appearently you didnt, why did you even bother posting that thing up there.

Anyhow, is there anybody else with something worthy?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 22nd Jan 2008 19:35
Quote: "No offence Mr.Zotoaster but if you havent even tried it yourself which appearently you didnt, why did you even bother posting that thing up there."


Just trying to help man

Your signature has been erased by a mod
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 24th Jan 2008 18:56
Quote: "Arent there examples with the Newton SDK?"

Quote: "Just trying to help man "


Soo, you have integrated those examples with DarkGDK and wanna help me with those?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Jan 2008 21:32
Ok, I guess you're right.

@Mods,

Cucumber's right. I suggest a rule is made where noone can post unless it helps him, not even if you are trying

Your signature has been erased by a mod
david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 24th Jan 2008 21:41
@Cucumber, there is no need to be rude like that. its the not best method to get help. I have got the sdk working...I was gonna help,,,now I'm not cause your to rude. sorry man.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 24th Jan 2008 22:36 Edited at: 24th Jan 2008 22:44
rude?
I wasnt rude, i just asked if he worked out the examples in newton SDK or not and wanna help me about that cause he seemed to have some knowledge as he was trying to help.

Appearently he doesnt have the knowledge as he mentioned.

and you david w, if you have somethin working, just show how generous you are to the community not only to me.

EDIT:
Oh by the way,
Quote: "I suggest a rule is made where noone can post unless it helps him, not even if you are trying."


With a slight change;
Quote: "I suggest a rule is made where noone can post unless he believes he has the right answer and he answers the question straight forward. Otherwise it crowds the topic unnecesarily."


I second that.
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 25th Jan 2008 05:15
Ok, I'm not the C++ guy (I only develop with DGDK.NET), but I think I'll take a try on this. I have everything here (including Newton (I'll just have to find the backup cd).

May I do any progress, you'll be informed soon. Let me only take some sleep now. :-P

@CuCuMBeR: Try not to be sarcastic (it's rudeness in some way too). Zotoaster was trying to help in his own way (although not using the most apropriate words, I agree).
@Zotoaster: Keep it up, you've been helping a LOT of people, but sometimes it's better to let it go instead of starting a flame war.

Ok, you too have been advised. I'm not from the M.O.D. SQUAD, but I have my contacts and clooooose friends. HUA HUA HUA
/me ROFL

Best regards to you two,
Thiago

PS: Is rudeness really a word or I made it up? You all know I'm from Brazil. Nah, my English is getting badder... WORSE. LOL
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 10:56
waiting for your attempt kBessa.

There is always one more imbecile than you counted on.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 25th Jan 2008 13:05
CuCuMBeR,

In the install directory of the NewtonSDK there is a doc folder, which explains how the examples work and why each bit is done. All you need to do is replace the OpenGL code with GDK code. This is what I did, it is pretty easy to follow, and the only problem I came across was extracting the position/rotation information from Newton to apply to the GDK objects.

But reading through the source code to the Newton DBP wrapper/plug-in that was kindly created by Walaber, you can see how he did it.

Following this tutorial you should be up and running in no time at all, especially if you have used the wrapper in DBP.

But if you want I will create a GDK friendly version of tutorial one, I have a day off today although I would highly recommend you try it yourself first it’s the best way to learn (not trying to be patronizing).

Who is your Daddy, and what does he do?
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 13:25
monotonic thank you for the advices and directing me to the exact location of the documentation of newtonSDK, and also letting me know about walabers release of the source code for the DBPro wrapper. As well you were probably going to direct me straight to his puzzle game competition entry "CONNECT MORE" game which he has written it with the DarkSDK which can be downloaded from his website again.

Okay, i took your advice and ran through all the docs and examples available which i mentioned in my first post which looks somethin like this:
Quote: "well, all my attempts of integrating this newton thing gets stuck at a point that i think im making somethin wrong but dunno what...
So, does anyone have a working project to show me how it is simply done? Like forexample the very first demo? "


Now for your generous offer, id really hate you to waste your day off for posting a simple rotating cube example. Also as you expressed it will not be the best way for me to learn..
But hell, id like to take the second best way if you dont mind posting that thing.

There is always one more imbecile than you counted on.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 25th Jan 2008 14:43 Edited at: 25th Jan 2008 14:45
Ok, I'm having a little trouble getting NewtonSDK to work with VS 2008 Professional, keeps saying unresolved external symbol.

I'm guessing this is because the library file is not compatible with 2008. If anyone else has got this working with 2008 then please let me know.


Just a quick note, I am waiting for the release of DarkPhysics for GDK to be released it is so much easier, plus you can get a free license from AGEIA if you engine utilises the SDK.

Who is your Daddy, and what does he do?
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 15:37 Edited at: 25th Jan 2008 15:38
howcome, david w said he has the SDK working, so you think he lied? That would be rude if he did lie.
Comeon david w show us what you got.

There is always one more imbecile than you counted on.
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 25th Jan 2008 16:15
Ok, I just got here to say that unfortunately my attempt will have to wait a few days cause I really won't have the available time.

@monotonic: It doesn't even compile the samples that come with NewtonSDK? They compiled here with no problems. Anyways, I'm using VC 2008 Express.

Ok, I'm off now. Hope somebody might be able to give directions earlier, but the quick look I gave on the samples and docs, it doesn't seem THAT difficult. If nobody do it, I'll get back to it on next week.

-Thiago
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 25th Jan 2008 16:30
Quote: "Appearently he doesnt have the knowledge as he mentioned."


If you can quote me a line that I said I knew how to get it working, then I will give in. I just don't see why you cant accept attempts to help, even a small one like mine. I guess us Greeks and you Turks are just not ment to be friends :/ Shame, I liked you at first.

Your signature has been erased by a mod
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 17:19
Hold your horses mr.Zotaster,
Quote: "I guess us Greeks and you Turks are just not ment to be friends "

does the above conversation have anythin to do about being greek or not? i didnt even know ur greek and most importantly i dont care what your nationality anyways, how childish your reaction is.

The important thing is, post somethin if you have knowledge on the topic, otherwise it is not called helping. its just crowding the thread with unnecessary stuff.

Hmm..
Quote: "I liked you at first."

What changed your mind, that i recently exposed the fact that im a Turk?
Sad.

There is always one more imbecile than you counted on.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 25th Jan 2008 17:38
Quote: "does the above conversation have anythin to do about being greek or not? i didnt even know ur greek and most importantly i dont care what your nationality anyways, how childish your reaction is."


I was pointing out the irony of our conflicting nationalities.

Quote: "The important thing is, post somethin if you have knowledge on the topic, otherwise it is not called helping. its just crowding the thread with unnecessary stuff."


Nobody can guarantee that everything they say will be 100% helpful. I didn't know if it would be, but I posted it on the off-chance that it was helpful. I didn't do it to get you to cry like a little baby.

Quote: "What changed your mind, that i recently exposed the fact that im a Turk?"


I liked you because you were a very talented coder, and yes, I knew you were Turkish then too. I find it insulting and childish to say, after that recent conversation, that I am a racist and that being the reason I changed my mind. The real reason I changed it was because you were being really immature, and instead of saying "Thank you" for my attempts to help, you use them against me and tell me that I am a useless thread filler.

I dont have time to argue with children like yourself. Enjoy working on your project.

Your signature has been erased by a mod
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 17:54
Quote: " was pointing out the irony of our conflicting nationalities"

Ottomans era has finished, so your kind should better get over it.

Quote: "that I am a racist "

I didnt say that, but people are how they feel like.

Quote: ""Thank you""

Thank you.

Quote: "Enjoy working on your project."

Oh dear, finally if you are finished, may we return to the topic now, if theres anything left.

Quote: ""Thank you" for my attempts to help"

Thank you Mr.Greek.

There is always one more imbecile than you counted on.
Cellbloc Studios
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Atlanta, GA
Posted: 25th Jan 2008 19:07
@CuCuMBeR:

Makes you want to scream huh?

Quote: "well, all my attempts of integrating this newton thing gets stuck at a point that i think im making somethin wrong but dunno what...
So, does anyone have a working project to show me how it is simply done? Like forexample the very first demo? "


Well from reading this first post, I gather that you already have been working with the GDK (this forum) and have worked with Newton AND that you are trying to get Newton working within the GDK and that you would like to find someone who may have converted the first demo of Newton over to GDK?

I have been fooling around with it also, but if I don't get the example 1 of Newton working shortly, I will be purchasing the Dark Physics. IF I get it working, I will email you and let you know what I figured out as well as post an example.

Your mod has been erased by a signature
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 19:23
@Cellbloc Studios
Thank you!!Oh god Thank you so much, you are the only one who understood what my question is and how i get to this point.

I will be waiting your post. Btw dont use e-mail, just post it here please if you get it working.
Thanks

There is always one more imbecile than you counted on.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 25th Jan 2008 19:29
Quote: "howcome, david w said he has the SDK working, so you think he lied?"



Quote: "Ok, I'm having a little trouble getting NewtonSDK to work with VS 2008 Professional, keeps saying unresolved external symbol.

I'm guessing this is because the library file is not compatible with 2008. If anyone else has got this working with 2008 then please let me know."






Who is your Daddy, and what does he do?
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 20:34
use the lib in the folder lib_mt

There is always one more imbecile than you counted on.
General Reed
18
Years of Service
User Offline
Joined: 24th Feb 2006
Location:
Posted: 25th Jan 2008 20:44
@CuCuMBeR - stop being so gay

CPU: AMD X2 6000+ 3.0ghz GFX: NVIDIA BFG Geforce 8800GTS 640MB OC-550mhz core RAM: 2048mb

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 25th Jan 2008 21:20 Edited at: 25th Jan 2008 21:24
Quote: "@CuCuMBeR - stop being so gay"


"There is always one more imbecile than you counted on." That was a myth for me right until you popped in @General Reed
Oh man, check your avatar image before you start talkin about being gay.

So, does anybody else has anythin stupid to puke in here? If not, can we go back to topic?

There is always one more imbecile than you counted on.
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 25th Jan 2008 21:27
CuCuMBeR

I've tried it mate, still no joy. If somebody else has got it working then there must be something I'm missing.

Anyhoo, DarkPhysics has been released for GDK, beats Newton hands down. Would you not consider buying this? It makes life a lot easier, plus as I said earlier AGEIA will give you a free license if you make good use of the SDK.

Who is your Daddy, and what does he do?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Jan 2008 21:51
Newton sux anyway - you have to do your own dampening constantly if you want high action without it screwing up.

Zotoaster, David W, and General Reed, Cell Bloc, and monotonic all RULE!

If you want 100% power - hit the PhysX lib directly - its not so hard. ODE or PAL are the other ones woth mention. Newton bogs down to ez - Stinks.

JAson

General Reed
18
Years of Service
User Offline
Joined: 24th Feb 2006
Location:
Posted: 25th Jan 2008 21:57 Edited at: 25th Jan 2008 22:12
@Cucumber - Look at ur avatar, Its the gay playboy version. U must begin to think about the way of the poo sandwich. My avatar is a general, my second names reed, so General Reed. Whats wrong with that?
And HAHA - u havent got DP.

@Jason. Thanks!

CPU: AMD X2 6000+ 3.0ghz GFX: NVIDIA BFG Geforce 8800GTS 640MB OC-550mhz core RAM: 2048mb

kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 25th Jan 2008 23:06
@mods:
I suggest locking this up. It's 80% of off-topic posts, and it's being transformed to a war, not what it should really be.

@everyone:
People, calm down!
If you're not going to help (just make the worse of it), do not post!
If you're asking for, do not be sarcastic of someone who did not help, somedy will eventually help you, don't get frustated or angry.

Ok, that's all.

-Thiago
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 25th Jan 2008 23:19
Agreed.

Your signature has been erased by a mod
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Jan 2008 02:01
Not all these posts are unhelpful - NEWTON is SLOW and goes nuts when momentum gets up there. You need to dampen it. If making it work is hard... making various dampeners so various "things" behave still correctly for the most part... then forget newton.

ODE is faster... and PAL is a wrapper library so you can code physics ONE WAY but it applies to Ageia, ODE, Newton and I think tomomak or whatever... which makes sense - learn one API - use the best pick of the litter .. or any one the user picks if your really good.

EVERY newton program I ran was a snail - like ... not kinda slow...like CRAWLING. Ageia - darkphysics or not - is WAY FASTER - and if the user has the CARD... its FASTER STILL... a good deal.

If you still want to invest time into Newton... thats all well and good ... but don't say you weren't warned.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 26th Jan 2008 08:56
Appearently my question is still not clear, anyhow.

@jason p sage
Quote: "NEWTON is SLOW and goes nuts when momentum gets up there. You need to dampen it."

Can you show me your implementation of Newton SDK which you found too slow and how you dampened it.
Or,
Quote: "ODE is faster."

Im broadminded, if you suggest using ODE, well, can you send me a simple implementation of ODE 0.9 or whatever the current release is, just to give me a quick start on ODE.
Or,
Quote: "EVERY newton program I ran was a snail "

Can i see the simplest one of your projects, i wanna see how slow is it, and most importantly how you implemented it on DarkGDK.

Thank you

There is always one more imbecile than you counted on.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Jan 2008 15:37
Unforntunately for you in this case - My opinions are based on googling for demos, examples, whatever ... even a few games I knew were done using the various physics engines. I was doing research BEFORE I bothered wasting my time coding to the API.

All my research thus far has brought me to my conclusions. I do have a working sample of code that Pixel Perfect did - a sort of DLL wrapper for ODE - but development on his end has stopped and he warned its not a full implementation.

I'd recommended writing directly to the API - and the manuals/documentation for whatever physics lib you chose to use should have a ton of info.

In PixelPerfect's Wrapper however, I wouldn't be surprised if you asked him for the source - he MAY delve it to you. That would help you cross the river so to speak to DarkGDK - enough at least so the rest of the API for ODE starts to click

so far in my research - all the physics libs require BASIC quareterion knowledge, and the ability to send lists of verts/triangles to them. This seems the tricky part to me.

One source snip won't set you free I'm afraid. I've been coding 25 years + and know a ton of languages - and I have to say - this is a heads down RESEARCH and DEVELOPMENT process - you need to narrow yourself down to the "Best Product" to use... then hunker down and study it like you're preping for College Finals.

I've been looking for a silver bullet. The closest Silver Bullet would Dark Physics - and frankly - its coming soon - and the price you pay - is for the silver

Good Luck my man sorry I can't be more help. This isn't nearly as easy as turning a cube or something.

Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 28th Feb 2008 23:45
I*'d recommend actually learning the PhysX API since DP has some commands missing. it's still a good tool, but if you want to do some specific task and you find out that you can't because of the commands not being available, then your screwed

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Feb 2008 23:59
Lover of Games - You do this? Did you have performance issues making the objects MOVE to where the physx wanted em?

Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 29th Feb 2008 04:16
I didn't really noticer a slow down mainly because i didn't fully use it to it's potential. i only had like 2 meshes

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 5th Mar 2008 03:25 Edited at: 5th Mar 2008 03:34
For starters, I have used newton before with many graphics sdks. So I know how it works, and how to implement it. I was implementing it with the gdk for a bit, but moved on to the Ogre SDK for various reasons. Now, I assume you have gotten the Newton world set up? If not, here is a basic code to get that setup :


Now, when you have newton set up, yes, I know, that is one line of code, unless you want to set the default material parameters, you should define two callbacks. Newton uses a torque and force callback and a transform callback. The transform callback is used to position and rotate an object you made. Now, on track with the development. You will want to create an object I assume. Now, one main problem I found with newton, is the lack of a Vector3 class or a Matrix4 class to use. So you will have to define your own! How lucky... Anyhow, I may just post the code for my own dMatrix and dVector classes so you can jumpstart easier. But back to creation of rigid bodies. It doesn't honestly take that much to create a rigid body. Here is a simple way of creating one :


That will create a box to a size you define. Simply replace the sizeX, sizeY, and sizeZ with float data types( as in real numbers ). You must set the userdata to the objects ID for use in the callbacks. Now, with all that done, you have to define callbacks for you to manipulate your object. The first callback I will tell you about is the applyForceAndTorque callback. You can really call it anything, but here is an example of what you would do:


What that does is define a callback which sets no torque, and sets the force to only act upon the Y axis, to simulate gravity. Then it applies the force and torque to the rigid body passed to it by the simulation. Register this function to the rigid body with :


That simply tells newton to call that every loop to check for a force or torque to apply to the rigid body. Pretty basic concept.

Now, to the slightly more advanced callback, the setTransformCallback. Here is an example of it:


That basically makes an instance of my custom matrix class, copies the matrix handed over by the function to my matrix instance, then gets the objects ID from the rigid body(so you know what object you are talking about), then positions and rotates based on the matrix(which the .m_x and so on is calling my vector class, which I will also upload for you). Now, you register that callback in the same way.


Now, that should be all you need to do with objects. Now on to updating newton. Very simple. In your main loop, simply call this:


Of course, you need to set a pointer to your NewtonWorld instance. And there you have it, that implementation should work. If there are problems, just ask, I am fairly skilled with newton. Notice I said fairly. I've attached a *.rar file with the dMatrix and dVector classes used in the code above. Oh, and a math file needed for the dMatrix class.

WC Physics - PhysX wrapper for Dark GDK.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-20 03:42:15
Your offset time is: 2024-11-20 03:42:15