Newton .NET wrapper

Share with us how are you using the powerrrr of the force

Moderator: Alain

Postby Robert Lettan » Sat Nov 20, 2004 2:01 am

Could someone please compile the Release version of the Control Library?
They haven't finished supplying the full SDK Resources with Visual Studio 2005 Beta 1 yet, and the last Visual C++ I have is 6.0 SP5.

It would really help as the version on sourceforge only had the Debug version pre-compiled.

Thank you.
User avatar
Robert Lettan
 
Posts: 8
Joined: Sat Nov 20, 2004 1:51 am
Location: England

Postby _vlad » Sat Nov 20, 2004 5:16 pm

Could someone please compile the Release version of the Control Library?

I suppose you're reffering to my NewtonWrapper library for .NET
Why do you need a release version ?
I've posted all the step by step instructions so you can do it yourself.
If you have any problem post here again.
_vlad
 
Posts: 36
Joined: Mon Oct 11, 2004 5:39 pm

Postby Robert Lettan » Mon Nov 22, 2004 8:27 am

It would've been alot easier if you'd done this, after all the actual compiling only took 5seconds.

Took me a good hour to setup the Solution for it, which Visual C++ 8.0 actually liked. It still didn't actually like the compile though:

Code: Select all
------ Build started: Project: Newton(Managed), Configuration: Release Win32 ------
Compiling...
NewtonWrapper.cpp
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_force_and_torque_callback.h(9) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::ApplyForceAndTorque __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_transform_callback.h(9) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::SetTransform __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_materials.h(67) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::ContactBegin __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_materials.h(72) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::ContactProcess __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_materials.h(77) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::ContactEnd __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_user_mesh_collision.h(9) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::UserMeshCollisionCollideCallback __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_user_mesh_collision.h(30) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::UserMeshCollisionRayHitCallback __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Newton Wrapper\NW_user_mesh_collision.h(51) : warning C4303: C-style cast from 'System::Object __gc *' to 'NewtonWrapper::Newton::UserMeshCollisionDestroyCallback __gc *' is deprecated, use static_cast, __try_cast or dynamic_cast
Linking...
Merging manifest files...
Build log was saved at "file://c:\Documents and Settings\Robert Lettan\My Documents\Visual Studio\Projects\Newton(Managed)\Newton(Managed)\Release\BuildLog.htm"
Newton(Managed) - 0 error(s), 8 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


Anyways.. Here is the compilation of both Debug and Release builds. These builds appear to have stopped that annoying bug that caused the Libraries to fail on-loading of the projects.
User avatar
Robert Lettan
 
Posts: 8
Joined: Sat Nov 20, 2004 1:51 am
Location: England

Postby _vlad » Mon Nov 22, 2004 4:12 pm

It still didn't actually like the compile though

ok ok I left some warnings. not a big deal.
These builds appear to have stopped that annoying bug that caused the Libraries to fail on-loading of the projects.

Strange, you mean the debug crashes ?
Anyway thanks for putting the release build here.
_vlad
 
Posts: 36
Joined: Mon Oct 11, 2004 5:39 pm

Postby Robert Lettan » Mon Nov 22, 2004 8:32 pm

Strange, you mean the debug crashes ?


Well it will load fine when your in the project, but then it will refuse to reload when you close the project and open it again. Quirky bug I guess.

Anyway thanks for putting the release build here.


No problem, look forward to the 1.3 version. You can finally make that one a proper Control Library rather than just a Linker :)
User avatar
Robert Lettan
 
Posts: 8
Joined: Sat Nov 20, 2004 1:51 am
Location: England

Postby hmgr » Tue Nov 23, 2004 9:24 pm

sorry dont get me wrong, but i dont understand why it is useful use your parser!
Can you explain?

Thanks
hmgr
 
Posts: 1
Joined: Tue Nov 23, 2004 9:21 pm

Postby The unProfessional » Tue Nov 23, 2004 10:02 pm

Parser? You mean wrapper?

Basically standard C libraries cannot be used in dot net unless they are ActiveX controls. This wrapper is implemented in Managed C++, which can actually create a bridge between the standard C library (Newton) and .Net (managed code). The wrapper just provide an interface to .NET applications.. and internally conducts conversions between managed and unmanaged code.

If you don't do .NET programming then it makes sense why you don't find the wrapper useful. .NET programmers can't use Newton w/o a wrapper 8)
The unProfessional
 
Posts: 131
Joined: Sun May 02, 2004 9:08 pm
Location: Southern California

Postby _vlad » Sun Dec 05, 2004 1:18 pm

I've updated the wrapper to Newton 1.30
http://sourceforge.net/projects/newton-dotnet/

It's named release 3 and there's the debug and release version.
I did not update the sources in CVS as I don't know how to change my local directory in wincvs. If someone wants the sources, I could arrange to put them somewhere.

Here is a part of "release notes.txt" :

Not everything is wrapped.
Just check inside the dll with ildasm or using auto-completion or object explorer to check if some feature is implemented.
however,
Vehicle joint OK
Ragdolls OK
TreeCollisions OK
UserMeshCollisions NO

Some functions are a little different than their Newton equivalent :
the most different functions are :

static void RagDollSetTransformCallback( int ragdoll, SetRagDollTransform* callback, int boneList __gc[] ) {
static void RagDollSetForceAndTorqueCallback( int ragdoll, ApplyForceAndTorque* callback, int bodyList __gc[] )

They take the boneList and the bone's body list to enable my wrapper to lookup for callbacks.
There's an exemple of how to handle that in "release notes.txt"
_vlad
 
Posts: 36
Joined: Mon Oct 11, 2004 5:39 pm

Postby Sascha Willems » Thu Dec 16, 2004 2:08 pm

One question : Are you working on a .NET 2.0-versiom? If not, I'd do that. .NET 2.0 offers many things (like DLLImport) to make writing headers easier than .NET 1.1. I've already started work, but if you already work on a .NET2.0 version, I'll stop my work.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Quimbly » Mon Dec 20, 2004 2:41 am

Could you also post Version 3 of the source code on the SourceForge project page, please?

The reason I ask is because the CreateSphere method seems to have changed between versions. I can't get it to work now...
Quimbly
 
Posts: 35
Joined: Wed Nov 03, 2004 6:45 pm

Postby walaber » Mon Dec 20, 2004 3:55 am

yeah, it now accepts 3 values, a radius for each axis, making general ellipsoids possible
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
walaber
Moderator
Moderator
 
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Postby uvlad » Mon Dec 20, 2004 2:17 pm

Sorry for the delay, my hard disk crashed. XP won't start.
Happily, the disk is not dead, I can read it with a DOS boot disk and a ntfs dos driver.
I should copy the wrapper source files to my 2nd computer (98, 200Mhz ouch) via a floppy and put them on sourceforge. I had to upgrade IE just to answer posts in this forum.
Either that or I wait to have a new computer (I found some work, I start in 1 month in London).

I'll do it the first way because you want them. I'll post here when I put them on sourceforge (or somewhere else if I fail).
Anyway, no more updates to the code for some time now.

PS : Yes I haven't touched at the CreateSphere function so it's likely to be out of date.

PS : I don't know which version of the .NET Framework I used, 1.1 I think but I'm not sure. Anyway you should be able to use my sources to start a 2.0 version.
uvlad
 
Posts: 4
Joined: Mon Dec 20, 2004 2:07 pm

Still having some problems with Newton.NET

Postby Quimbly » Tue Dec 21, 2004 1:46 am

Hi there,
I've finally got some time to try out Newton.NET again, but I'm still running into a few problems. Basically, I'm just reproducing Tutorial1 from the Newton download.

Very straight-forward stuff:

Code: Select all
NewtonCollision collision;
static int nWorld;
static int iRibidBodySphere;

nWorld = Newton.Create(0,0);
int iCollision = Newton.CreateSphere(nWorld, 0.0f, 0.0f, 0.0f, null);
int iRibidBodySphere = Newton.CreateBody(nWorld, iCollision);
Newton.ReleaseCollision(nWorld, iCollision);
Newton.BodySetMassMatrix(iRibidBodySphere, 1.0f, 1.0f, 1.0f, 1.0f);

position[0] = 0.0f;
position[1] = 0.0f;
position[2] = 0.0f;

Newton.BodySetMatrix(iRibidBodySphere, position);

float[] velocity = new float[3];
velocity[0] = 1.0f;
velocity[1] = 1.0f;
velocity[2] = 1.0f;

Newton.BodySetVelocity(iRibidBodySphere, velocity);


And then in my Timer tick event:

Code: Select all
Newton.Update(nWorld, 1.0f);

position = Newton.BodyGetMatrix(iRibidBodySphere);

sphere.x = position[12]; //Px
sphere.y = position[13]; //Py
sphere.z = position[14]; //Pz

glView.reDraw();


However, I keep getting a nagging exception:

System.NullReferenceException: Object reference not set to an instance of an object.
at NewtonBodyGetMatrix(NewtonBody* , Single* )
at NewtonWrapper.Newton.BodyGetMatrix(Int32 body)
at NewtonTest.MainForm.mainTimer_Tick(Object sender, EventArgs e) in c:\documents and settings\all users\documents\visual studio projects\newtontest\newtontest\mainform.cs:line 154
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)


Line 154 refers to:
position = Newton.BodyGetMatrix(iRibidBodySphere);

Any ideas why this is happening?
Quimbly
 
Posts: 35
Joined: Wed Nov 03, 2004 6:45 pm

Postby Quimbly » Tue Dec 21, 2004 4:29 pm

Has anyone else had a problem like this?
Quimbly
 
Posts: 35
Joined: Wed Nov 03, 2004 6:45 pm

Postby uvlad » Wed Dec 22, 2004 10:55 am

As said earlier, the Newton.CreateSphere function is not uptodate in my version 3 of the wrapper : the function's signature is wrong (the new version of newton takes 3 radius to make ellipsoids).

Try the same but with a box instead of a sphere, does it work ?

But maybe I'm wrong. I can't check my sources, my hard disk crashed.
They're not lost just quite difficult to recover.
uvlad
 
Posts: 4
Joined: Mon Dec 20, 2004 2:07 pm

PreviousNext

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 1 guest

cron