Anyone here has experience with C++ ? (phys X)

I'm trying to call PhysX from Java but so far I haven't even been able to compile/run any of their samples.

i'm really interrested to know if someone here got it to work and how.

I posted this on the PhysX forum but so far nobody answered.


I've been trying now for 3 days straight to use PhysX 2.7.x but still no luck. The libraries are not linkable it seems.

It can compile it but will not link And that was only after I modified the nx.h and nxMath.h plus some other files that relied on MS things it looked..

I come from Java and have some experience with C++ and different physics and game engines, so it can't be totally newbie errors. Why is it this so diffult ?

It seems that PhysX is geared towards one compiler and one compiler only..fine..but what compiler is that and where do we get it ? From looking at the code I sense MS VS version X and fear Version 6 (because where can we get it ?).
And you mention visual studio 2003 as well in your getting started guide..but you also say that you could use whatever compiler you want.

I tried with many compilers so far (Dev C++, Eclipse CPT with MingW)I also tried VS2005..Also impossible. Opening the solutions do no good as well.

I tried every possible way..building a project from scratch or including headers, copying headers. putting libs here or there..

Nm it works now..

Just to anyone else trying this. Forget getting it to work with anything else than Visual Studio. Sucks.

Ageia is working on a Linux version as well. It isn't available for the latest release but there was a beta a couple of releases ago.

Hey, Per, it's been a long time since you were posting, welcome back :). Answering to this thread does not mean you are going to do PhysX support, does it? :stuck_out_tongue:

I'm afraid not :slight_smile:

I can't stop lurking around, hehe :slight_smile: I've spent some time porting good old Marble Fun to the latest jME version and jME Physics 2. Hope to share it with you guys soon.

cool :smiley:

nice to have you lurking around! keep it up :wink:

Right now I'm working on PhysX4j and it works pretty well. Can stack boxes and the good old Domino demo.

I'm planning on implementing dynamics first then fluids, cloth etc. later. Right now I'm just picking what I need myself and that's dynamics.

I'm trying to get it acknowledged for Sourceforge or so you can give it a try.

I expect to get the joints finished within a month or so.

Here's some sample code:

package net.physx4java.demos.simple;

import physics.World;
import physics.dynamics.actors.Actor;
import physics.dynamics.actors.ActorParameters;
import physics.dynamics.actors.BoxActor;
import physics.dynamics.actors.GroundPlaneActor;
import physics.dynamics.actors.Material;
import physics.dynamics.actors.SphereActor;

public class SimpleActorDemo {
   public static void main(String args[]) throws Exception {
      //Create a new world
      World world =  new World();
      //set gravity
      world.setGravity(0, -9, 0);
      //create a groundplane
      new GroundPlaneActor();
       * create actors (a box and a sphere)
      ActorParameters params = new ActorParameters();
      Actor box = new BoxActor(params,0.5f,0.5f,0.5f);
      Actor sphere = new SphereActor(params,0.5f);
      //set mass of actors
      //set actor position
      box.setPosition(100, 1000, 100);
      sphere.setPosition(100, 100, 10);
      //assign material to box and sphere
      Material material1 = new Material();
      //iterate the world
      for(int i=0;i<90000;i++) {
         //add force just for fun
         sphere.addForce(100, 0, 0);
         //step the world
         world.update(0.01f);//set stepsize here
         //print results
         System.out.println("Position of objects : "+box.getPosition()+";"+sphere.getPosition());
         System.out.println("Velocity ="+box.getLinearVelocity()+" "+sphere.getLinearVelocity());
         System.out.println("Force ="+box.computeKineticEnergy()+" "+sphere.computeKineticEnergy());
         //System.out.println("Rotation:n "+box.getRotation()+";n"+sphere.getRotation());

Any chance of getting some videos of the demos when you get a little further along?  Great initiative BTW, not of huge use to me personally with my current game, but it's cool to see something like this coming over to Java and enriching not only the jME community but the entire Java gaming community.

First I've heard of anyone getting anything to work in Java with PhysX…this is exciting. :)  We just need to work it into jME-Physics and it will be awesome to be able to switch between PhysX and ODE (not that anyone would still use ODE of course).  :stuck_out_tongue:

As soon as I get somewhere to post the repository I'll post the svn URL here. Anyone interested in helping out are welcome of course.

I would suggest Google Code, but if for whatever reason you have problems getting anything set up I'd be happy to host the project for you. are now telling me that I need to upload some code before they will acknowledge me…but it's impossible to upload anything BEFORE I'm

acknowledged…Will try google code. Thanks darkfrog will do if this fails. Do you have subversion on your server ?

OK fine…now I have the repository at googlecode…but the old one I used (a free 10mb at cvsdude) is giving me problems. I disconnected from it and tried

to connect to the google one. But each time it tries to use the one at cvs dude (its subclipse)

Right now I can only commit to the one at cvs dude regardless of what I write in the URL. Even brandnew projects called dfdsfmkdskf(for example).

Will solve it and post again…

Yes, I use SVN.

You probably didn't tell it to delete the SVN directories on the local copy when you disconnected.  If you're on Windows open up the folder in Windows Explorer and search for ".svn" and then delete all the results from the file system.

Thanks I just think that I don't have a lot of experience in SVN…but now it works…

They use Visual C++ 7, just in case you were still wondering.  :wink:

I'm using VS 2005…which is also called Visual Studio 8 ?

I had it working in Eclipse except for linking…

Anyway going to Visual Studio in any form or shape was like going back to

the stoneage. Eclipse will truly spoil you :slight_smile:

Microsoft versioning is strange to say the least…