Heightfields:This could be the beginning of a new friendship

betajaen

10-01-2007 13:31:42

I haven't decided on should it be 0.4, 0.6 or RC4 in the next release. As it's going to be the biggest.

So I'll just dump screen shots and code snippets as I go along, quite unprofessionally, and I won't wait until I finish the particular feature, I'll just say about it when there is something to see.

betajaen

10-01-2007 13:43:47

New Wheel System, I'm working on.

Tutorial 701


myCube = mScene->createBody(
"myCube",
"cube.1m-2m-1m.mesh",
new cubeShape(Vector3(1,1,2)),
1.0f,
params<rigidbody>("orientation:0.707106781 0.707106781 0 0"),
Vector3(0,3.5,0)
);

myCube->freezeRotation(Vector3(1,0,1));
myCube->setAngularDamping(0.5f);

myWheel = wheel::attachToBody(myCube, Vector3(0,-1,0));


Tutorial 702


myCube = mScene->createBody(
"myCube",
"cube.1m-2m-1m.mesh",
new cubeShape(Vector3(1,1,2)),
1.0f,
params<rigidbody>("orientation:0.707106781 0.707106781 0 0 "),
Vector3(0,3.5,0)
);

wheelSet myWheels = wheelSet::createFourWheelSet(myCube, Vector3(-1,0,-1), Vector3(-1,0,1));

myWheels.frontLeft->setMotorTorque(100);
myWheels.frontRight->setMotorTorque(100);


Since wheels can be assigned roles now (steer, motor, steer and motor,etc.), and types (frontLeft, backRight, etc.), the wheelSet is quite a handy class to work with. Which also includes some helper helper functions such, myWheels->turn(Ogre::Radian(Ogre::Degree(20)), which will turn all STEERING wheels only.

Quite quite handy.

Second feature I want is to have a entity and SceneNode attached to each wheel. I haven't decided on if I'll have a listener system that'll update the wheel positions automatically, but that requires a central repository of all wheelSets and wheels, or handle perhaps through the state machine some how, or just leave it up to the user.

Third is, a physical convex shape that gives the wheel a bit of a presence, so when you run over something it behaves like a wheel rather than a 2D disc.

DaCracker

10-01-2007 17:53:43

Great work Betajaen! I'm looking forward to implent this
into my game engine! :D

betajaen

10-01-2007 18:00:51

Excellent.

However, I hoped you noticed that the create four wheel helper function, only requires TWO vectors to put four wheels down.

DaCracker already knows what they do, but a free slice of cake who figures out what they actually mean, and how the function can work out where to put the wheels.

:D

luis

11-01-2007 09:24:17

hi!
This is my first time posting here, i'm a OgreOde user :o

I've been looking the code of NxOgre tutorials and i want to play a bit with this wrapper, and see how hard would be to port my code to NxOgre.
The game i'm doing uses heightfield (which is supported in NxOgre) and cars....

betajaen, my question is: is it planned in a near future to make a more 'automatic' Vehicle class? by automatic i mean:
- spheres and cube's dimensions taken directly from .mesh (using an EntityInformer or something else) to build collision primitives
- an xml loader similar to the one in OgreOde
- and the last thing: anti-sway

please notice i'm not asking you to implement those things, i'm just asking if it is in your mind to add more funtionality to the prefab objects ;)
thanks!

pd: NxOgre looks really good! :)

Toby

11-01-2007 18:36:14

Great idea, I implement my own vehicle class to make my game. But as you see I have a bug. Your work will help me. :D

betajaen

18-01-2007 16:36:41



The wheels now rotate around properly now, unlike the previous vehicle class in the older versions of NxOgre.

The vehicle is behaving more like one, and is even displaying some real-life behaviour when turning (back wheel goes up, forward wheel goes down), something I experienced many times going around roundabouts in a land rover.

The code implementation is really easy to work with as well. The demo above is just made out of this:

myCube = mScene->createBody("myCube","racecar.mesh",new cubeShape(Vector3(1,1,3)),1000.0f,Vector3(10,10,10));
myCube->mActor->setCMassOffsetLocalPosition(NxVec3(0,-1,0));

myWheels = wheelSet::createFourWheelSet(myCube, Vector3(-1,0,1.25f), Vector3(-0.75f,0,-1.25f), 0.5f);
myWheels.addEntities("wheel50cmx10cmx50cm.mesh");


And it's/will be controlled by:

if (isKeyDown(X)) {
myWheels.turn(Degree(1));
}

if (isKeyDown(NEG_X)) {
myWheels.turn(Degree(-1));
}

if (isKeyDown(Z)) {
myWheels.setMotorTorqueAll(75.0f);
}

if (isKeyDown(NEG_Z)) {
myWheels.brakeAll()();
}


Far easier than the old horrible vehicle class!

betajaen

19-01-2007 13:43:42

Fantastic news!

Somehow, I managed to get convex and cloth work in Debug mode. All it needed was a slight change in code. Instead of compiling the convex and cloth meshes into memory, I did it to disk instead. And it works!

Well, I think it's fantastic news anyway ;)

CaseyB

19-01-2007 15:47:33

Instead of compiling the convex and cloth meshes into memory, I did it to disk insteadWon't that have a severe performance penalty?

betajaen

19-01-2007 15:52:56

Only the disk access time. The convex shape file was only 900 bytes and it's only used when NxOgre is compiled as Debug, Release it uses the memory to build it, and once it's built it's not used again.

Besides, I haven't noticed any slowdown.

CaseyB

19-01-2007 16:56:40

Very cool then! Good work!

DaCracker

19-01-2007 17:53:56

Amazing work! :D

luis

20-01-2007 20:02:41

hi again!
i'm still new here so maybe many of my questions could just have no sense :)

Somehow, I managed to get convex and cloth work in Debug mode.

So there is a chance to build and run apps in debug mode ?

The code implementation is really easy to work with as well. The demo above is just made out of this:

cool ! is it in CVS now ?

I've been playing and taking a look of the code in 0.4rc2 and i must say it was impressive. The simulation is really fast (i made a test with heightmaps) and the code very intuitive, and: SIMPLE and clean.... nice desing @Betajaen :)

The only thing that surprises me a bit is that some of the atributes in classes are 'public'. I think you made that because you wanted to make it in the KISS way....

betajaen

20-01-2007 20:29:29

So there is a chance to build and run apps in debug mode ?


Hi, Yep. Infact I've been working in Debug mode (NxOgre and the Tutorials) for over 3 months now. I can't even remember what release looks like. :D

cool ! is it in CVS now ?

No, I don't use the CVS anymore. It ruins the surprises. I make semi-regular updates anyway, with enough new stuff to keep people busy until the next release. So they don't moan anymore ;)

The only thing that surprises me a bit is that some of the atributes in classes are 'public'. I think you made that because you wanted to make it in the KISS way....

Pretty much. NxOgre is inspired mostly from Ruby and Python, I will spend hours trying to get a feature working in a sensible and KISS way than a C or C++ way. i.e. The "params" class ;)

luis

20-01-2007 20:52:09

thanks for your fast reply!

No, I don't use the CVS anymore. It ruins the surprises.

LOL :) the only problem i see is that if people sends you modifications merging the code could be a pain (and they cant send to you patchs)....

I'm really interested in the code you're working right now, we (my 'team') are planning to port our project from OgreOde to NxOgre this is our teaser (a bit outdated):
http://www.telecable.es/personales/cgc/lw/teaser1.avi

if I use CVS now should it be more up to date than 0.4rc2 ?

betajaen

20-01-2007 21:02:25

Nice Video!

No oddly enough the CVS version is over 6 months old. The latest public release is 0.4 RC3.

luis

21-01-2007 11:14:40

Nice Video!
thanks ! ;)
No oddly enough the CVS version is over 6 months old. The latest public release is 0.4 RC3.

Well i'll be busy doing the first basic port (no vehicles) for a while, but please update the CVS !! or release something soon ! i'm very impatient ! :)

betajaen

21-01-2007 11:31:03

The 0.4RC3 release is only a few weeks old. It's brand new!

betajaen

21-01-2007 12:57:27

Someone sent us the frog





Now, I just have to bind Froggy's vertices to the mesh vertices ;)

NickM

22-01-2007 12:15:57

this is our teaser (a bit outdated):
http://www.telecable.es/personales/cgc/lw/teaser1.avi


That looks really good, nice work!

luis

22-01-2007 18:36:20

thanks for the comments!
i hope to add the same video to "Projects Using NxOgre" soon :)

betajaen

24-01-2007 15:48:45




Believe it or not, but that is some progress on implementing soft bodies into NxOgre. It's supposed to be a piece of a jelly cube. Of course my implementation of real-time fluid meshes is even worse ;)

In the words of T. F. Gumby - "My brain hurts!"

NickM

24-01-2007 22:11:05


In the words of T. F. Gumby - "My brain hurts!"

lol I bet it does, you are a star, keep up the great work for us all to enjoy :D

betajaen

31-01-2007 13:57:41

Okay, some new tidbits. Some of the code interfaces have changes, which will effect most of your programs.

I'll show it in code:

Code Changes
new meshShape("myMesh.mesh")

Additions

mBody->moveTo(Vector3(3,3,3));

mBody->moveTo(mBody2);

mBody->moveTowards(Vector3(3,3,3));

mBody->moveTowards(mBody2);

mBody->moveAway(Vector3(3,3,3));

mBody->moveAway(Vector3(3,3,3));

mScene->moveBody(mBody, mScene2);



New Semantic and Helper functions


mScene->createBody("myCube", "cube.1m.mesh", Cube(1), Density(10, TONS), Vector3(0,10,0));

mScene->createBody("mySphere", "sphere.50cm.mesh", Sphere(0.5f), 10.0f, Vector3(0,10,0));

luis

01-02-2007 10:04:11

Do you have more screenshots and/or comments about the new Wheel class?
i want to start dreaming with the next release.... :)

Dirso

05-02-2007 20:46:16

Hi,

Could I dl 701 and 702 tutorials anywhere?

Thanks,
Dirso.

betajaen

05-02-2007 21:00:51

Not yet, the wheel system and tutorials 701 and 702 are for a later release.

syedhs

06-02-2007 11:52:40

Betajaen,

The WheelShape class seems not to provide collision ie it seems that WheelShape is only for force calculation, steering etc but when the wheel runs over a small body eg box no collision happen. What is your thought on this? Do I forget a flag somewhere, or do I need to provide my own collision object on top of the WheelShape eg 4 rotating cylinders (for each of the wheel) which is always repositions exactly to the WheelShape's position?

betajaen

06-02-2007 12:09:08

As in does the wheel go through the body, or the box doesn't really collide with the wheel but the wheel collides with the box.

If it's the latter then is true, because it's more a less a ray spinning around. The cylinders would work, but make them a teeny bit smaller than the ray, so the cylinders don't act as wheels.

syedhs

06-02-2007 15:28:24

The wheels go through the body as if there are no wheels attached. You can observe this via SampleRaycastCar in Ageai's sample, try spawning a Monster Truck (the one with big oversized wheels). Shoot a box and carefully readjust the truck so that only wheels touch the box. You can see that the truck simply pass thru it, not hitting it.

betajaen

11-02-2007 23:12:24



Thanks to imtrobins heightfield class and Luis's changed, we have heightfields.

mScene->createStaticBody("terrain", "", new heightfieldShape("terraincm.png", 1024,1024,64,513,513));

Amazing that PhysX is handling such a large mesh without breaking a sweat.

DaCracker

12-02-2007 06:36:57

Cool! Maybe this will be the beginning of some RTS games using
NxOgre? :)

betajaen

12-02-2007 13:16:47

Perhaps, even better - NxOgre Rally!



I can safely say, I think we are all looking forward to the next release. :D

DaCracker

12-02-2007 14:52:59

Perhaps, even better - NxOgre Rally!

I can safely say, I think we are all looking forward to the next release. :D


Indeed my friend! :D

Loockas

18-02-2007 13:30:37

Would this support PLSM2?

betajaen

18-02-2007 13:37:48

Grom has been working on PLSM2 with it, in a few threads down.