NxOgre 0.9 - JSON the fourth serialisable format. - 0.9-28

betajaen

07-05-2007 20:46:42

Happy Birthday Betajaen!

NxOgre 0.9 is a complete rewrite of the existing NxOgre 0.6. With a lot of new features and changes including support for Windows and Linux. It is the regarded public beta for NxOgre 1.0 which is estimated to be release within a few months.

There are no tutorials or documentation, the entire code is purely given from the NxOgre subversion server. It is not designed for newbie use, it currently does not have the same features of 0.6.

Download for Visual Studio, Windows, Eihort, PhysX 2.7.0

1. Install TortoiseSVN.
2. Go to your Ogre library folder (c:/dev/)
3. New Folder, name as NxOgre
4. File, SVN, SVN Checkout
5. Change the URL to "http://latest.nxogre.org/nxogre3/";
6. Click okay
7. Open up the project and compile.

(NxOgre 0.9 doesn't use an environmental variable for itself anymore (NXOGRE_DIR). So you don't have to modify the existing one.)

Download for Code::Blocks, Linux, Eihort, PhysX 2.6.2

Install PhysX normally according to the instructions. The default NxOgre PhysX header and library locations are the following, but if they are not; copy them over or adjust the project settings.

Headers:
/usr/local/include/PhysX/Cooking/Include
/usr/local/include/PhysX/Foundation/include
/usr/local/include/PhysX/Framework/include
/usr/local/include/PhysX/NxCharacter/include
/usr/local/include/PhysX/NxExtensions/include
/usr/local/include/PhysX/Physics/include
/usr/local/include/PhysX/PhysXLoader/include
.so's:
/usr/local/lib/


Make sure you have subversion installed, and fire up a terminal. Execute the command:

svn co http://latest.nxogre.org/nxogre3/

Open up the project file in Code::Blocks and Compile!

Note: My experience with Linux is pretty low, so I cannot give the same level of support as I do with Visual Studio.

How to submit an NxOgre.log file on to the forums

I've added a small piece of code to format the log to phpBB format.

mWorld = new World("log: phpbb");

It'll be saved as nxogre.log.phpbb


How do most things

World:
mWorld = new World();

Scene:
mScene = mWorld->createScene("Main", mSceneMgr, "gravity: yes, floor: yes");

Most Dynamic Bodies (Actors with a scenenode):
mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1), Vector3(0,3,0), "Mass: 100");
mScene->createBody("sphere.50cm.mesh", new SphereShape(0.5), Vector3(0,6,0), "Mass: 20");
mScene->createBody("capsule.50cmx1m.mesh", new CapsuleShape(0.5,1), Vector3(0,8,0), "Mass: 15");
mScene->createBody("convex1.mesh", new ConvexShape("convex1.mesh"), Vector3(0,10,0), "Mass: 7.5");
mScene->createBody("prism.8x50cmx2m.mesh", new PrismShape(0.5,2,8), Vector3(0,12,0), "Mass: 5");

Most static Bodies:
mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1), Vector3(0,3,5), "static: yes");

betajaen

07-05-2007 20:48:53

May 7th, 2007

Current Code

0.9-16
- Fixed problem with dynamic shapes not being rendered or simulated in classes that inherit actor.
<Betajaen> 15-Apr-2007

0.9-15
- Fixed changes.txt.
- Character Controller system added:
- CharacterController class.
- Character class
- CharacterMovementVectorController class.
- CharacterHitReport class
- List container created (a Container without an ID).
- New Log system with Text,HTML and PHPBB formats added, based
- on the errorReporter class.
- Joint Set 1 created.
- RDC prototyped.
- Motor class reserved.
<Betajaen> 11-Apr-2007

0.9-14
Dynamic shapes system added. Inital wheelShape and wheel code created.
<Betajaen> 11-Apr-2007

0.9-13
Initial Joints added. Revolute Joint added.
<Betajaen> 17-Mar-2007

0.9-12
Raycaster implemented. The raycaster can cast all three types: All, Any, Closest and accurate to the
bounds or shape level.

Fixed missing TerrainShape files.
<Betajaen> 14-Mar-2007

0.9-11
Implemented TerrainShape and Terrain.
<Betajaen>

0.9-10
Rewrote the param system. Took away the template interface, Params names now go "ClassNameParams". Made the code
more neater and faster by using the Params::Set method, which will convert almost any string type into it's normal
type.

Found a few bugs and plugged them too.
<Betajaen>

0.9-9
Fixed memory leak in Actor.
<Betajaen>

0.9-8
NxOgre uses the even-odd numbering system. Odd being the development and unstable version, and even for bugfixes.
The last number represents the SVN revision. 0.9 will be the unstable version of 1.0
<Betajaen>

----------------------------------------------------------------------------------------------------------------

SVN: 5
Linux Support added

SVN: 4
Shapes Ported

SVN: 1
First dump of code.


Future Bits

Luis has completed the wheel system for us and set up the library to use pre-compiled headers for much faster compile time. I'll be submitting the changes later on in the week and I have some new bits to add in as well.

tsky

07-05-2007 21:22:08

Happy Birthday Betajaen!



Yeah,

happy birthday to you and thanx for the gift !!! :-)

tom

jchmack

08-05-2007 02:24:54

Happy Birthday Betajaen!!!

Wish me luck killing these guys in Tekken =)

edit: also does 0.9 work with the eihort update? Figured they might not be compatible since they were releases so close together. Meh... they probably are since there are not really any syntax changes to eihort.

betajaen

08-05-2007 10:29:49

Fight! I have no idea if it does. I expect it will without any problems though.

WhiskeyJim

08-05-2007 10:56:30

Happy yester-birth-day! Thanks for keeping up all these cute projects. :)

luis

08-05-2007 13:26:29

happy birthday betajaen! and thanks for your time and your effort doing this wonderfull lib!

Caphalor

08-05-2007 13:33:24

Happy birthday. :D
Also from me, a very big thanks for your work, I don't know what I would do without NxOgre. ;)
When I finish this damn shader stuff I will try to port my "game" to 0.9, hope it won't be too much work. :)
PS: Is there a chance that in upcoming versions, there will be a ragdoll system implemented? :P

Lexx

08-05-2007 14:15:17

YEAH!!!! happy birthday, man!!!
and happy birthday NxOgre 0.9 too!!!! it's great work, betajaen! thx 4 all!

Bob

08-05-2007 14:30:24

happy birthday from me too.

I use 0.6 at the moment and will convert to 0.9 when all features from 0.6 are in 0.9.

Thanks for the great nxOgre :)

betajaen

08-05-2007 17:59:13

Thankyou chaps ;)

@Caphalor - Ragdolls, are subject to contributions. I'm sure someone will start the code for me, just like Luis pretty much wrote the new wheel system.

@Everyone else - Get portin'!

Wretched_Wyx

08-05-2007 19:46:56

Happy belated birthday Betajaen, sorry I missed it :cry:. I really only have time now to pop in on the forums now and then... It might be awhile before I have "free time" like in the past. I did however take the time to download and compile (and implement) the 0.9 release, without any problems at all. Very nice. I like the new NxWay of things :wink:.

betajaen

08-05-2007 20:23:21

No excuse, but I'm getting less free-time by the minute too.

But I'm very pleased you managed to get it compiled and running, meaning the others around here shouldn't have any problems either.

jacmoe

11-05-2007 21:59:57

Happy Birthday Betajaen!
I second that! :D

Early May is the best time of the year to be born - my birthday is the day before yours (not the same year, though), and Mother Nature brings the finest presents! :)

betajaen

11-05-2007 22:04:13

Well, Happy Birthday Jacmoe then! And early May is an excellent time to have a birthday.

gugus

12-05-2007 11:40:21

I am realy late (lot of work at school) but HAPPY birthday.NxOgre is wonderfull!

betajaen

15-05-2007 19:24:01

15-May-2007

0.9-17
- Implemented pre-compiled headers.
- Raycaster bug fixed (when casting over a NxActor that doesn't have an Actor has a userdata).
- Character controller bug fixed.
- NxOgrised the Wheel System.
- Some interface improvements, bug fixes and clean up.
- LGPL headers added.
<Betajaen> 15-May-2007

- Set the Visual Studio project to handle precompiled headers.
- Implemented Wheel System.
<Luis Fornero> 15-May-2007


Apologies to people who I've said that I'll add their fix and it's not there. But it'll be in there soon - probably.

[Edit]

0.9-18
- Properly implemented precompiled headers.
<Luis Fornero and Betajaen> 15-May-2007

daedar

15-05-2007 19:41:50

Have you fixed the mesh-scale parameter for the NxGenerateTriangleMeshFromOgreMesh function? :D

betajaen

15-05-2007 19:47:40

Not yet, but thanks for reminding me.

danharibo

16-05-2007 20:20:56

I'm a tad confused, do the wheels work?
Edit: Nvm,

betajaen

16-05-2007 22:54:35

Something to look forward to in 0.9-19





Who says debugging can't be pretty?

jchmack

17-05-2007 08:10:10

my.... GOD!..........

danharibo

17-05-2007 16:25:02

What happend to world::getSingelton() ? :evil:

betajaen

17-05-2007 16:42:03

I took it out.

betajaen

17-05-2007 19:33:47

0.9-21





0.9-21
- Fixed a lockup when destroying a collection of things that contained a class that isn't owned by NxOgre.
- Fixed a problem with the 2.7.x Character system used with PhysX 2.6.0
- Rewrote the HTML and CSS in the HTML log.
- Improved on the error system.
- Implemented Helpers
- Implemented the Motor class, Math is wrong (torque is way to high) but works.
<Betajaen> 17-May-2007



Example WheelSet and Motor Code

Construct code:

mBody = mScene->createBody("racecar.mesh", new CubeShape(1,1,3), Vector3(0,5,0), "mass: 1000");
mBody->setCMassOffsetLocalPosition(Vector3(0,-1,0));

mWheelSet = WheelSet::createFourWheelSet(mBody, Vector3(-0.5f, -0.1f, 1.25f), Vector3(0.5f,-0.1f,-1.25f), 0.25f);
mMotor = new Motor("Motor", mScene, &mWheelSet.Drive);
mWheelSet.attachDriveShaft(mMotor);
mWheelSet.addMeshes("wheel50cmx10cmx50cm.mesh");


Car control code:

float Speed_in_KPH = mBody->getNxActor()->getLinearVelocity().magnitude() * 3.6f;

if (steer_left) {
mWheelSet.turn(Ogre::Degree(-1.0f));
}
else if (steer_right) {
mWheelSet.turn(Ogre::Degree(1.0f));
}

if (accelerator_pedal_down) {
mMotor->setAcceleration(1.0f);
}
else {
mMotor->setAcceleration(0.0f);

}

if(brake_pedal_down) {
mWheelSet.setBrakeTorque(250.0f);
}
else {
mWheelSet.setBrakeTorque(0.0f);
}


if (gear_up) {
mMotor->shiftGear(1);
}
else if (gear_down) {
mMotor->shiftGear(-1);
}

Xed

17-05-2007 19:48:30

The best!

:shock: :D

But I'm asking again:

How can I do car's body of few meshes?
:?: :?: :?: :?:

betajaen

17-05-2007 19:51:12

mBody = mScene->createBody("car.mesh", new CubeShape(1,1,1), Vector3(0,4,0), "mass: 2000");
mBody->addShape(new CubeShape(1,1,1, "position: 1.5 0 0"));
mBody->addShape(new CubeShape(1,1,1, "position: 2.5 0 0"));


Roughly like that.

If your confused any futher; look in the PhysX documentation for multi-shape actors. All in a nice CHM file in your Start Menu.

Xed

17-05-2007 20:04:27

Great tnkx!

:D

NickM

17-05-2007 20:19:02

Great work as ever betajaen :shock: we all owe you so much.

danharibo

17-05-2007 21:08:24

..\source\NxOgrePhysXDriver.cpp(202) : error C2059: syntax error : '<<'
:cry:

ANdys

17-05-2007 21:18:42

maybe :roll:

s << "Unable to start the PhysX SDK!" << std::endl << std::endl << "Please refer to the developer or publisher's website or support line for information relating to the errors detailed." <<
<< std::endl << std::endl << " -> Error Code: PhysX SDK is unavailable. Please install the PhysX System Software." << std::endl


TO

s << "Unable to start the PhysX SDK!" << std::endl << std::endl << "Please refer to the developer or publisher's website or support line for information relating to the errors detailed." << std::endl
<< std::endl << std::endl << " -> Error Code: PhysX SDK is unavailable. Please install the PhysX System Software." << std::endl;

danharibo

17-05-2007 21:34:29

Thanks!

betajaen

17-05-2007 21:47:17

Weird. I've committed the change to the SVN anyway, for anyone else who compiler explodes on them.

danharibo

17-05-2007 22:01:22

Damn, I can't use push_back on the WheelSet anymore, and i Really need to do that. But according to Google, Push_back is a member of list :evil:

betajaen

17-05-2007 22:05:27

It's not a STL list, it's a Betajaen List, you want "insert".

See NxOgreContainers.h for more information

danharibo

17-05-2007 22:06:03

It's not a STL list, it's a Betajaen List, you want "insert".

See NxOgreContainers.h for more information
:lol: :roll:

HexiDave

18-05-2007 07:12:03

Didn't see it mentioned, but I'm a Double Precision guy (Ogre compiled such that Ogre::Real's are doubles, not floats) and all the things that specifically require return of float (i.e. readFloat() and the vertex buffer returns) currently have Ogre::Real's in their place. It won't compile unless the code is edited to change those instances of Ogre::Real with float - a few other minor compile errors (fopen_s and the bad SDK driver loading error message), but that's the main issue I had.

Finally have nxOgre to play with - keep up the good work :D

betajaen

18-05-2007 10:18:51

PhysX uses NxReals which are floats, surely you'd loose precision?

But have fun anyway ;)

HexiDave

18-05-2007 10:34:33

*scratches head* Why would I lose precision?

I'm saying that the typedef for Ogre::Real for me ISN'T float, it's double - several spots in the code where Ogre::Real is supposed to return a float, it is trying to return a double in my code, which is a no-no. I just fixed it to say "float" instead of "Ogre::Real".

betajaen

18-05-2007 10:38:31

No, what I meant was; If you passed the double into the float, than the float into the double, you'd loose precision then?

HexiDave

18-05-2007 10:45:36

Ah, I see. Yes, in that case - I use doubles elsewhere in my app for other reasons. I thought you meant converting from floats to doubles lost precision and... I was confused.

betajaen

18-05-2007 13:53:24

The Remote Debugger Rocks



I've started to wrap the Remote Debugger, so far it's been very promising. With the first feature being to match the Camera position and orientation in the Ogre::RenderWindow and the Debugger Window on the laptop there- seamlessly and on every frame.

mWorld->getPhysXDriver()->createDebuggerConnection("192.168.1.103");
mWorld->getPhysXDriver()->getRemoteDebuggerConnection()->addCamera(mCamera);


That's it. Seriously.

Apparently you can pass on triangular mesh information into it as well, so I can see the contents of the Scene Manager being mirrored in there ;)

daedar

18-05-2007 14:08:00

What we can do with the Remote Debugger is very impressive!!!!!!!!!
and that Apparently you can pass on triangular mesh information into it as well, so I can see the contents of the Scene Manager being mirrored in there would be amazing! This is really a good point for PhysX compared to all others physic engine.

You'll say that I insist (and sorry for that) but I can't really use the debugger for my app as my meshes are too big and we can't scale the static meshes for now. But that sounds really good betajaen :D

Xed

18-05-2007 16:13:51

:evil:
:shock:


Why I cant move back\front my vehicle in 0.9??????

Xed

18-05-2007 16:31:44

Oh! I'm understand, but why


void setAcceleration(NxReal acceleration); // 0..1
void setBreaking(NxReal brake); // 0..1 void shiftGear(unsigned int gear); // -5..0..5


why it's from 0 to 1
????
:?:

betajaen

18-05-2007 16:39:32

Because it's a decimal percentage: If the foot is halfway down the pedal, then it's 0.5, if it's fully down then it's 1.0.

danharibo

18-05-2007 17:02:28

For some reason, My meshes are failing to bake, why?

betajaen

18-05-2007 17:06:21

Hmm. It might be because of duplicate vertices, does this work with you?

mScene->createBody("convex1.mesh", new MeshShape("convex1.mesh"), Vector3(4,4,4), "static: yes");

danharibo

18-05-2007 17:09:40

Ok, i used the cube mesh and that loaded, but it crashes here now:
iterator end()
{ // return iterator for end of mutable sequence
return (iterator(_Myhead, this));
}

Last but one line, std::list

betajaen

18-05-2007 17:11:45

cube.1m.mesh works for me too. I'm using Debug mode if that makes a difference.

You had a STL problem yesterday didn't you? I wonder if it's messed up somehow?

danharibo

18-05-2007 17:18:56

cube.1m.mesh works for me too. I'm using Debug mode if that makes a difference.

You had a STL problem yesterday didn't you? I wonder if it's messed up somehow?
Here is my wheel code if it helps:
void Vehicle::AddWheel(Ogre::String MeshName,bool driving,bool turning, Ogre::Vector3 Pos, Ogre::Vector3 Pin)
{
//Maek Wheels hyrr
Wheel* mWheel = new Wheel(WheelShape(30),WheelParams(),new NxOgre::Actor(MeshName,mScene,new ConvexShape(MeshName),Pose()));
if(driving)
{
pWheelsDrive->mWheels.insert(mWheel);
}
else
{
pWheelsNonDrive->mWheels.insert(mWheel);
}
if(turning)
{
mWheel->setSteeringAngle(Ogre::Radian(Ogre::Degree(40)));
}
else
{
mWheel->setSteeringAngle(Ogre::Radian(Ogre::Degree(0)));
}


}

Is there anything wrong?

betajaen

18-05-2007 17:35:29

Not good. Your getting two leaks there, and the wheel isn't being added to the actor.

Roughly your code should go:


Create the Vehicle Chassis before hand:
void Vehicle::createChassis(Ogre::String MeshName) {
mVehicleChassis = mSceneMgr->createBody(MeshName, new ConvexShape(MeshName), Vector3(0,0,0), "mass: 1000");
}



Add a wheel:
void Vehicle::addWheel(bool driving, bool steering, Ogre::Vector3 pos, float wheelRadius) {

Wheel* mWheel;

mWheel = static_cast<Wheel*>(mVehicleChassis->addShape(new WheelShape(wheelRadius, "offset:" + Ogre::StringConverter::toString(pos)));

mWheelSet->mWheels.insert(mWheel);

if (driving)
mWheelSet->Drive.insert(mWheel);

if (steering)
mWheelSet->Steering.insert(mWheel);

}



Personally if I was you and the Vehicles use four wheels, then just use the 4WD WheelSet helper.

void Vehicle::addWheels(Vector3 frontLeft, Vector3 backLeft, float radius, bool motorPowered, Ogre::String wheelMesh) {

mWheelSet = WheelSet::createFourWheelSet(mVehicleChassis, frontLeft, backLeft, radius);
mWheelSet.addMeshes(wheelMesh);

if (motorPowered) {
mMotor = new Motor("Motor", mScene, &mWheelSet.Drive);
mWheelSet.attachDriveShaft(mMotor);
}
}



I'll be expanding the WheelSet and Motor class in the future to allow gear ratios to be set, 6 wheel drive and so on. Assuming if you want to go through that route.

danharibo

18-05-2007 17:52:00

Personally if I was you and the Vehicles use four wheels, then just use the 4WD WheelSet helper.

void Vehicle::addWheels(Vector3 frontLeft, Vector3 backLeft, float radius, bool motorPowered, Ogre::String wheelMesh) {

mWheelSet = WheelSet::createFourWheelSet(mVehicleChassis, frontLeft, backLeft, radius);
mWheelSet.addMeshes(wheelMesh);

if (motorPowered) {
mMotor = new Motor("Motor", mScene, &mWheelSet.Drive);
mWheelSet.attachDriveShaft(mMotor);
}
}
I'm making to code to be used with Lua, so a four wheel set wouldn't work.


I'll be expanding the WheelSet and Motor class in the future to allow gear ratios to be set, 6 wheel drive and so on. Assuming if you want to go through that route.

danharibo

18-05-2007 18:02:33

iterator end()
{ // return iterator for end of mutable sequence
return (iterator(_Myhead, this));
}

Still crashing on the same line. Can i re-Download Stl?

betajaen

18-05-2007 18:40:00

1st - You could make a simple function wrapper for it, in C++ and call it in Lua.

2nd - I think it's part of Visual Studio or the Platform SDK.

danharibo

18-05-2007 19:48:44

1st - You could make a simple function wrapper for it, in C++ and call it in Lua.

2nd - I think it's part of Visual Studio or the Platform SDK.
What i meant was the user can create any amounts of wheels, i know how to use Lua. And i'm updating the pSDk, whould that help?

betajaen

18-05-2007 19:53:30

0.9-23 released
0.9-23
- Materials implemented into primitive and convex shapes.
- Remote Debugger Class started.
- Ogre Cameras can be passed into the Debugger. Still has a bug with Camera direction
- Added line to function names in debug reports.
<Betajaen> 18-May-2007


How to use Materials
NxOgre::Material* mat = mScene->createMaterial("Testy");
mat->setAll(1,0,0);

mScene->createBody("convex1.mesh", new ConvexShape("convex1.mesh", "Material: Testy"), Vector3(0,1,0), "Mass: 1000");


Remote Debugger

Start up the RemoteDebugger (it's in the start menu) on your target computer either your development computer, or another on a network.

Append this after world:
mWorld->getPhysXDriver()->createDebuggerConnection("ip_address_of_computer");

Cameras are buggy, but you can pass it on anyway. (Select the camera name from the View menu):
mWorld->getPhysXDriver()->getRemoteDebuggerConnection()->addCamera(mCamera);

danharibo

18-05-2007 21:56:19

c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(275) : error C2059: syntax error : '<<'
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(277) : error C2059: syntax error : '=='
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(278) : error C2653: 'PhysXDriver' : is not a class or namespace name
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(278) : error C2143: syntax error : missing ';' before '{'
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(278) : error C2447: '{' : missing function header (old-style formal list?)
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(286) : error C2653: 'PhysXDriver' : is not a class or namespace name
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(287) : error C2065: 'mDebugger' : undeclared identifier
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(288) : error C2541: 'delete' : cannot delete objects that are not pointers
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(293) : error C2059: syntax error : '}'
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(293) : error C2143: syntax error : missing ';' before '}'
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(293) : error C2059: syntax error : '}'
c:\programing\newnxogre\nxogre\source\nxogrephysxdriver.cpp(294) : error C2059: syntax error : '>>'

What the heck.

betajaen

18-05-2007 22:03:07

Indeed. Either your entire Visual Studio install is messed up, or you didn't download the SVN changes properly.

danharibo

18-05-2007 22:05:03

Indeed. Either your entire Visual Studio install is messed up, or you didn't download the SVN changes properly.SVN did give an error about a conflict in this file, could that be the problem?

betajaen

18-05-2007 22:09:31

Indeed. Either your entire Visual Studio install is messed up, or you didn't download the SVN changes properly.SVN did give an error about a conflict in this file, could that be the problem?

It could be.

I just tried downloading the SVN from a fresh directory and it was fine. Perhaps you can re-download it from a fresh directory and compile again?

danharibo

18-05-2007 22:26:31

Indeed. Either your entire Visual Studio install is messed up, or you didn't download the SVN changes properly.SVN did give an error about a conflict in this file, could that be the problem?

It could be.

I just tried downloading the SVN from a fresh directory and it was fine. Perhaps you can re-download it from a fresh directory and compile again?
Yes that's fixed it.

danharibo

18-05-2007 22:29:46

IT'S STILL CRASHING :evil:
Should i Re-Install MsVc++? or change to C::B

CaseyB

18-05-2007 22:32:18

Yup! If you are using Tortoise, then all you need to do is find the file with a yellow ! instead of a green check. Right-click on that file and go to TortoiseSVN->Edit Conflicts. Though, there should not have been a conflict if you didn't change anything in that file. You may be better off just deleting it and doing another update.

danharibo

18-05-2007 22:35:30

Yup! If you are using Tortoise, then all you need to do is find the file with a yellow ! instead of a green check. Right-click on that file and go to TortoiseSVN->Edit Conflicts. Though, there should not have been a conflict if you didn't change anything in that file. You may be better off just deleting it and doing another update.It's STL::List that's crashing my app, with the end() function.

betajaen

18-05-2007 22:35:34

I don't even think it's the SVN now. If he's working from fresh code that him and I am using, if it compiles for me, it'll compile for him.

So it must be his IDE and STL.

CaseyB

18-05-2007 22:53:34

Yup, sorry, I clicked the icon to go to the latest post and it only took me to the end of the first page!

daedar

19-05-2007 15:13:30

It is said that the shiftGear method can have parameter value from -5 to 5 but the parameter is an unsigned int...

ghiboz

19-05-2007 15:20:48

hi again!
I tried the latest version, compile all good, but after, in my code (that worked fine with the previous version when I create the wheels:

mWheelSet = NxOgre::WheelSet::createFourWheelSet(bodyCar, wheel_lf_Pos, wheel_lb_Pos, 600.0f);

gives an error in the NxOgre_d.dll....

I don't know why....

regards! :wink:

danharibo

19-05-2007 16:51:11

hi again!
I tried the latest version, compile all good, but after, in my code (that worked fine with the previous version when I create the wheels:

mWheelSet = NxOgre::WheelSet::createFourWheelSet(bodyCar, wheel_lf_Pos, wheel_lb_Pos, 600.0f);

gives an error in the NxOgre_d.dll....

I don't know why....

regards! :wink:
Update your DLL.

danharibo

19-05-2007 18:12:34


What.
manual->index(2);
I now this isn't NxOgre but seriously, what?

betajaen

19-05-2007 18:13:59

I think STL is screwed up on your machine in a big way. I'd reinstall Visual Studio and the platform SDK.

danharibo

19-05-2007 18:16:07

I think STL is screwed up on your machine in a big way. I'd reinstall Visual Studio and the platform SDK.I'll Re-Start, i just reinstalled MsVc++

danharibo

19-05-2007 18:34:38

It's still crashing at end(); Can you Test this code?
void Vehicle::AddWheel(bool driving, bool steering, Ogre::Vector3 pos, float wheelRadius)
{
Wheel* mWheel;

mWheel = static_cast<Wheel*>(pBody->addShape(new WheelShape(wheelRadius, "offset:" + Ogre::StringConverter::toString(pos))));

mWheelSet->mWheels.insert(mWheel);

if (driving)
mWheelSet->Drive.insert(mWheel);

if (steering)
mWheelSet->Steering.insert(mWheel);


}

<~Creatine~>

19-05-2007 18:54:54

Hey Betajaen! Where are there cloth, contact reporter, intersection and particle from 0.9? I saw these in older version. Is 0.9 not a newer version or what? :oops:

betajaen

19-05-2007 18:55:58

It's still crashing at end(); Can you Test this code?

Sort of, this works with me:

ShapeParams sp;
sp.setToDefault();
sp.mOffset = NxVec3(-1,0,0);

WheelParams wp;
wp.setToDefault();
wp.setToNormal();

Wheel* mWheel = static_cast<Wheel*>(mBody->addShape(new WheelShape(1,sp,wp)));

mWheelSet.mWheels.insert(mWheel);
mWheelSet.Drive.insert(mWheel);
mWheelSet.Steering.insert(mWheel);


@Creatine

Yes it is newer, but the code is written from scratch so the nice things in 0.6 are missing.

<~Creatine~>

19-05-2007 19:10:07


@Creatine

Yes it is newer, but the code is written from scratch so the nice things in 0.6 are missing.

(I try inject contact report and intersection modules for my game...)

Oh, but I see a nice wehicle (wheels) system.
Can it simulate car sliding?

betajaen

19-05-2007 19:18:34

I believe so - at one point when I was tweaking the wheels it appeared to drive on ice, and experienced over steer.

danharibo

19-05-2007 21:04:51

Vehicle.obj : error LNK2001: unresolved external symbol "class NxVec3 __cdecl NxOgre::toNxVec3(class Ogre::Vector3 const &)" (?toNxVec3@NxOgre@@YA?AVNxVec3@@ABVVector3@Ogre@@@Z) :evil:
It's static_cast time :lol:

danharibo

20-05-2007 11:54:08

your code fails at mRoot->Startrendering()
ShapeParams sp;
sp.setToDefault();
sp.mOffset = dynamic_cast<NxVec3>(pos);

WheelParams wp;
wp.setToDefault();
wp.setToNormal();

Wheel* mWheel = static_cast<Wheel*>(pBody->addShape(new WheelShape(1,"offset: "+Ogre::StringConverter::toString(pos),wp)));

mWheelSet->mWheels.insert(mWheel);
mWheelSet->Drive.insert(mWheel);
mWheelSet->Steering.insert(mWheel);

This is really annoying.

ghiboz

20-05-2007 12:02:38

hi again!
I tried the latest version, compile all good, but after, in my code (that worked fine with the previous version when I create the wheels:

mWheelSet = NxOgre::WheelSet::createFourWheelSet(bodyCar, wheel_lf_Pos, wheel_lb_Pos, 600.0f);

gives an error in the NxOgre_d.dll....

I don't know why....

regards! :wink:
Update your DLL.


the dll is updated (the new debug mehtods work), but this crashes...
a thing that i discovered is that the intellisense code is not shown...

strange!!

betajaen

20-05-2007 12:09:49

Close Visual Studio, and delete "your-project-name-goes-here.ncb" and open your project again. It'll scan the linked headers again.

danharibo

20-05-2007 12:52:59

It's fixed, but the wheels don't appear. why?

danharibo

20-05-2007 17:48:50

Ok, now i have a mesh, but once i try to use my own models as ConvexShape, it crashes. D:

betajaen

20-05-2007 17:53:23

Check for duplicate vertices, PhysX hates them with a fiery passion.

danharibo

20-05-2007 18:10:57

Ok, I'm sure i removed all Doubles, still crashes.

betajaen

20-05-2007 18:48:09

How many vertices are there?

danharibo

20-05-2007 18:51:36

451

betajaen

20-05-2007 19:08:44

Arck! Way to high.

I'd say 100 vertices is the maximum.

danharibo

20-05-2007 19:22:05

Arck! Way to high.

I'd say 100 vertices is the maximum.
Even For a Convex? :S

betajaen

20-05-2007 19:37:46

Arck! Way to high.

I'd say 100 vertices is the maximum.
Even For a Convex? :S


Yep. The less the faster it is. PhysX will optimise it anyway, and the more vertices you'll have the more it'll cut out.

danharibo

20-05-2007 20:15:34

Arck! Way to high.

I'd say 100 vertices is the maximum.
Even For a Convex? :S


Yep. The less the faster it is. PhysX will optimise it anyway, and the more vertices you'll have the more it'll cut out.
Ok, my artists made a 24 poly coll model for the Vehicle, thanks!

danharibo

20-05-2007 20:56:52

How do i set the Radius of the Wheel?

betajaen

20-05-2007 21:05:21

It's one of the arguments in the WheelShape constructor.

danharibo

20-05-2007 21:06:57

It's one of the arguments in the WheelShape constructor.I swear i'd lose my head if it wasn't stuck on.

betajaen

20-05-2007 22:20:03

Does anyone fancy proof reading the new wiki page for me? I think I rambled a bit in the branches section.

NickM

20-05-2007 22:37:27

Does anyone fancy proof reading the new wiki page for me? I think I rambled a bit in the branches section.
I've had a quick read through and corrected a couple of typing errors, there's a couple of sentences that don't make sense...

It is common knowledge that PhysX is a fast and powerful physics library, and it working with NxOgre high-frame rates with complicated scenes are common

The Third Generation of NxOgre was started by Betajaen in 2007, being redesigned and rewritten from scratch, with cleaner and smaller code, it has remained it's speed and ease of use

Apart from that it's looking good, well done.

betajaen

20-05-2007 22:55:27

Cheers, I'll have another stab at it tomorrow. I tend loose the ability to communicate at the end of the day, oddly enough my programming skills gain by ten fold. :?

ghiboz

21-05-2007 08:57:44

Close Visual Studio, and delete "your-project-name-goes-here.ncb" and open your project again. It'll scan the linked headers again.
thanks very much! :wink:

danharibo

21-05-2007 16:44:59

hmm, it seems that getEntity crashes in release mode 0.o
Actually it's setMaterial() That's causing th crash.

jchmack

21-05-2007 20:38:16

Is there a way i can keep actors from colliding in 0.9. I used to use collision groups but from what im seeing they are not here.

tsky

22-05-2007 08:56:29

Hi,

because of my xml-parser i make/create a list of shapes. Than i createBody with with first of shapes and after that i add the shapes with addShape.
Unfortunatly it crashes if the Ogre::SceneMgr will render the SceneNode of this body !!
If i change :

createBody("", pShape, pose, param)
to
createBody("", new NxOgre::CubeShape(..), etc)


it will run !? Why that ?

please i need the primitives (cube, shpere, prims etc) and group working...

tom

betajaen

22-05-2007 09:15:54

Nothing is wrong with that code, it'll work both ways. It's most likely your code; pShape is most likely to be NULL or incorrect.

You should also pass on a meshName there, else it won't create a SceneNode for you.

tsky

22-05-2007 09:25:08

Nothing is wrong with that code, it'll work both ways. It's most likely your code; pShape is most likely to be NULL or incorrect.

You should also pass on a meshName there, else it won't create a SceneNode for you.


Sorry for that but was only reduced code snippes. Looks like this:


pShape = m_ShapeGroup.getShapeIndex(0);

if (pShape != NULL) {
Ogre::String shapeName = m_ShapeGroup.getShapeName(pShape);

pBody = m_pNxOgreSceneRef->createBody(strMeshName,
pShape,
bodyPose,
actorParams);

for (ui32 i=1; i<nShapes; i++) {
deBug.log(DEBUG_INFO, "NxOgreLoadScene::doPhysicalBody() add shape[%u]", i);
pShape = m_ShapeGroup.getShapeIndex(i);
pBody->addShape(pShape);
}
m_pBodyManagerRef->addBody(pBody);


m_ShapeGroup is a Managed-HashMap of my shapes i previous parse and create:



// create material
Ogre::String strMatName = Ogre::String("mat_" + strName);
NxOgre::Material *pMaterial = new NxOgre::Material(strMatName, m_pNxOgreSceneRef);
pMaterial->setAll(fElasticity, fDynamicFriction, fStaticFriction);

// set pose
NxOgre::ShapeParams pShapeParam;
pShapeParam.mOrientation = shapePoseParent.getQuat();
pShapeParam.mMaterial = strMatName;

// create shape
NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(width, height, length, pShapeParam);
if (pCubeShape != NULL) {
if (fMass > 0) {
pCubeShape->mShapeDescription.mass = fMass;
}
}

m_ShapeGroup.addShape(strName.c_str(), pCubeShape);


This code crashes if the SceneMgr from Ogre will render the Bodies SceneNode...

betajaen

22-05-2007 09:38:52

if (pCubeShape != NULL) {
if (fMass > 0) {
pCubeShape->mShapeDescription.mass = fMass;
}
}


Take out that and see what happens.

tsky

22-05-2007 10:43:49

if (pCubeShape != NULL) {
if (fMass > 0) {
pCubeShape->mShapeDescription.mass = fMass;
}
}


Take out that and see what happens.


Ok, i try...no change.

I try this too:


//Material
Ogre::String strMatName = Ogre::String("boxmaterial");
NxOgre::Material *pMaterial = new NxOgre::Material(strMatName, m_pNxScene);
pMaterial->setAll(0.3f, 0.3f, 0.5f);
// set pose
NxOgre::ShapeParams pShapeParam;
pShapeParam.mMaterial = strMatName;

// create shape
NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(1, 1, 1, pShapeParam);
NxOgre::Body *pBody = m_pNxScene->createBody(
"cube.1m.mesh",
//new NxOgre::CubeShape(1,1,1),
pCubeShape,
Ogre::Vector3(0,50,0),
"Mass: 100"
);


right after this:


createNxOgre();

m_pRoot->renderOneFrame();


crash...


SceneManagerFactory for type 'OctreeSceneManager' registered.
SceneManagerFactory for type 'TerrainSceneManager' registered.
SceneManagerFactory for type 'BspSceneManager' registered.
Registering ResourceManager for type BspLevel
[INF] [14266619 | 11:37:13 ] GeVEPhysicsServerNxOgreApp::createNxOgre()
NxOgre::PhysXDriverParams::parse#53 (3)
This function called contains no or little code.
NxOgre::PhysXDriver::PhysXDriver#79 (3)
NxOgre NxOgre 0.9-23.Debug'I Heart NxOgre'
NxOgre::PhysXDriver::PhysXDriver#138 (3)
NxOgre (NxOgre 0.9-23.Debug) Started, working with:

- PhysX => 2.7.0
- Ogre => 1.4.1 'Eihort'
- Hardware => Athena 1.0
- Platform => Windows Debug

NxOgre::Material::Material#49 (3)
Using material manually named 'Default' with Material Index as 0

[LOG] [14267200 | 11:37:13 ] ManagerJoints::ManagerJoints()
NxOgre::Material::Material#36 (3)
Created material 'boxmaterial' with Material Index as 1



I hope you could check it on your system whit this. In this code snippet i do not use any special from me.

tom

betajaen

22-05-2007 10:54:03

I can't.

Listen, if the following code actually works then obviously it's your shape creation code.

NxOgre::Body *pBody = m_pNxScene->createBody(
"cube.1m.mesh",
new NxOgre::CubeShape(1,1,1),
Ogre::Vector3(0,50,0),
"Mass: 100"
);


Either your hashmap of shapes isn't giving out the right shape, or the arguments given to the CubeShape aren't correct.

But from what I see, the first case is more likely the suspect. i.e. Check if "strName.c_str()" is actually 0 and not something else.

tsky

22-05-2007 11:43:45

I can't.

Listen, if the following code actually works then obviously it's your shape creation code.

NxOgre::Body *pBody = m_pNxScene->createBody(
"cube.1m.mesh",
new NxOgre::CubeShape(1,1,1),
Ogre::Vector3(0,50,0),
"Mass: 100"
);


Either your hashmap of shapes isn't giving out the right shape, or the arguments given to the CubeShape aren't correct.

But from what I see, the first case is more likely the suspect. i.e. Check if "strName.c_str()" is actually 0 and not something else.


No Sir. It is not my strName or else. In my code snippet i removed all of my code.

I tested this:


// create material name
Ogre::String strMatName = Ogre::String("boxmaterial");
// create material
NxOgre::Material *pMaterial = new NxOgre::Material(strMatName, m_pNxScene);
// default values
pMaterial->setAll(0.3f, 0.3f, 0.5f);
// create a ShapeParams -> perhaps not correct working ERROR?
// correct use ?
NxOgre::ShapeParams *pShapeParam = new NxOgre::ShapeParams();
// set material
pShapeParam->mMaterial = strMatName;

// create shape
// work not ERROR!!
//NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(1, 1, 1, *pShapeParam);
// work
NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(1, 1, 1);

NxOgre::Body *pBody = m_pNxScene->createBody(
"cube.1m.mesh",
--> pCubeShape,
Ogre::Vector3(0,50,0),
"Mass: 100"
);


please notice the line of creating the shape! If i use the param class it does not work!
Perhaps the default constructor ??!? don´t know...

perhaps you could give me a hint for correct using of the Params and ShapeParams class ?

tom

betajaen

22-05-2007 11:50:50

NxOgre::ShapeParams pShapeParam;
// set material
pShapeParam.mMaterial = strMatName;


NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(1, 1, 1, pShapeParam);

Or better still:

NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(1, 1, 1, "Material:" + strMatName);

daedar

22-05-2007 11:51:04

Why don't you just use the string representation of the ShapeParam instead of instantiating a new one?
Your 4th param should be "material: " + strMatName no?

betajaen

22-05-2007 11:54:26

Either way is fine, also if you use the any params class like that you should set it to default before hand:


NxOgre::ShapeParams pShapeParam;
pShapeParam.setToDefault();
pShapeParam.mMaterial = strMatName;

tsky

22-05-2007 12:08:32

Why don't you just use the string representation of the ShapeParam instead of instantiating a new one?
Your 4th param should be "material: " + strMatName no?


how do i get acces to the pose ? "orientation: " + pose.getQuat().toString() ? ;-)

I have to set my own pose:


NxOgre::ShapeParams shapeParam;
shapeParam.mOrientation = shapePoseParent.getQuat();
shapeParam.mMaterial = strMatName;


-> Making a Quat to a String and somewhere else this Sting will be converted back to an Quat !?

Is there an an toString() method ?

betajaen

22-05-2007 12:11:55

Ogre::StringConverter::toString(...)

tsky

22-05-2007 15:22:56

Ogre::StringConverter::toString(...)

ok. some part now seems to work:


Ogre::String strParam("Material : " + strMatName);
// set pose
strParam.append(", Orientation : ");
strParam.append(Ogre::StringConverter::toString(shapePoseParent.getQuaternion()));

// create shape
NxOgre::CubeShape *pCubeShape = new NxOgre::CubeShape(width, height, length, strParam);
if (pCubeShape != NULL) {
if (fMass > 0) {
pCubeShape->mShapeDescription.mass = fMass;
}
}

thanks. But....;-) sorry for bugging


i think in the params class is something wrong :



this WORKS result is a dynamic body:
pBody = m_pNxOgreSceneRef->createBody(strMeshName,
pShape,
bodyPose,
"mass : 50");

this result in static body
pBody = m_pNxOgreSceneRef->createBody(strMeshName,
pShape,
bodyPose,
"mass : " + Ogre::StringConverter::toString(fMass));



could you tell me why ?

confused tom

tsky

22-05-2007 15:57:36




this WORKS result is a dynamic body:
pBody = m_pNxOgreSceneRef->createBody(strMeshName,
pShape,
bodyPose,
"mass : 50");

this result in static body
pBody = m_pNxOgreSceneRef->createBody(strMeshName,
pShape,
bodyPose,
"mass : " + Ogre::StringConverter::toString(fMass));



could you tell me why ?

confused tom


yes. the problem is not the params. the "problem" is the interpretation of parameters.

some light in darkness:

if you have a mass=0.0f than all bodies are static, whatever other params may say. :-(

daedar

22-05-2007 16:01:21

if you have a mass=0.0f than all bodies are static, whatever other params may say.

And what's the problem with that? In EVERY physic engine, a zero mass body is a static body. Aren't you confused between static and kinematic bodies?

tsky

22-05-2007 16:12:04

if you have a mass=0.0f than all bodies are static, whatever other params may say.

And what's the problem with that? In EVERY physic engine, a zero mass body is a static body. Aren't you confused between static and kinematic bodies?


No,

but had a density of 1.0f and a mass of 0.0f so i expected not a static body. In ageia a body/actor only is static if BOTH values are zero. An kinematic bodies had to toggle(raise) to be kinematic.

Hint: my physical scene descriptions works till 0.6, as you can see in the thread of projects using NxOgre.

danharibo

23-05-2007 17:22:02

In Release, getEntity() Becomes and In-Valid Pointer.

betajaen

23-05-2007 17:44:09

I can see a related bug, but even if you assign a meshName to the Body?

danharibo

23-05-2007 18:57:38

I can see a related bug, but even if you assign a meshName to the Body?How do i do that? So far i've only been creating Vehicles.

betajaen

23-05-2007 19:04:59

mBody = mScene->createBody("meshNamegoeshere", ...);

danharibo

23-05-2007 19:08:14

pBody = mScene->createBody(MeshName, new ConvexShape(CollName), Pos, "mass: 4000"); There's the code, Don't know how to fix it

betajaen

23-05-2007 19:13:32

That's fine, as long as MeshName is "blah.mesh".

You could try changing the body constructor in NxOgreBody.cpp from:

Body::Body(const NxString& identifier, Scene* scene, ShapeDescription *firstShapeDescription, const Pose& pose, ActorParams params)
: Actor(NxCreateID(scene->getNbActors(), identifier), scene, firstShapeDescription, pose, params),
mNode(0)
{


to:

Body::Body(const NxString& identifier, Scene* scene, ShapeDescription *firstShapeDescription, const Pose& pose, ActorParams params)
: Actor(NxCreateID(scene->getNbActors(), identifier), scene, firstShapeDescription, pose, params),
mNode(0), mEntity(0)
{


It'll fix the random pointer bug when an Entity isn't used, but for some reason called via getEntity, but your problem - probably not.

Dirso

23-05-2007 22:41:14


1>c:\nxogre\include\nxogreerror.h(36) : error C2143: syntax error : missing '}' before '='
1>c:\nxogre\include\nxogreerror.h(36) : error C2059: syntax error : '='
1>c:\nxogre\include\nxogreerror.h(38) : error C2143: syntax error : missing ';' before '}'
1>c:\nxogre\include\nxogreerror.h(38) : error C2238: unexpected token(s) preceding ';'
1>c:\nxogre\include\nxogreerror.h(40) : error C2146: syntax error : missing ';' before identifier 'Type'
1>c:\nxogre\include\nxogreerror.h(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(40) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(49) : error C2061: syntax error : identifier 'PhysXDriver'
1>c:\nxogre\include\nxogreerror.h(52) : error C2061: syntax error : identifier 'ErrorReporter'
1>c:\nxogre\include\nxogreerror.h(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(53) : error C2143: syntax error : missing ',' before '&'
1>c:\nxogre\include\nxogreerror.h(56) : error C2146: syntax error : missing ';' before identifier 'getNewReport'
1>c:\nxogre\include\nxogreerror.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(56) : warning C4183: 'getNewReport': missing return type; assumed to be a member function returning 'int'
1>c:\nxogre\include\nxogreerror.h(66) : error C2146: syntax error : missing ';' before identifier 'mReporters'
1>c:\nxogre\include\nxogreerror.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(70) : error C2143: syntax error : missing ';' before '*'
1>c:\nxogre\include\nxogreerror.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\nxogre\include\nxogreerror.h(80) : error C2143: syntax error : missing ',' before '&'
1>c:\nxogre\include\nxogreerror.h(103) : error C2059: syntax error : '}'
1>c:\nxogre\include\nxogreerror.h(103) : error C2143: syntax error : missing ';' before '}'
1>c:\nxogre\include\nxogreerror.h(103) : error C2059: syntax error : '}'
1>c:\nxogre\include\nxogrelog.h(28) : error C2504: 'NxOgre::ErrorReporter' : base class undefined
1>f:\challenge games\usc\usc\usc\gs_racing.h(31) : error C2143: syntax error : missing ';' before '}'
1>f:\challenge games\usc\usc\usc\gs_mainmenu.cpp(295) : warning C4018: '<' : signed/unsigned mismatch


The NxOgre.dll compiles fine, but my game doesn't. I've got all this message errors.

Anyideas why?

Thanks,
Dirso.

betajaen

23-05-2007 23:06:22

Are you including it like the following?

#include "NxOgre.h"

Dirso

24-05-2007 02:09:14

Yes. Here is my code:
#ifndef __GS_RACING_H__
#define __GS_RACING_H__

#include "GameState.h"
#include "CarLoader.h"

#include "NxOgre.h"

using namespace eCGFW;

class GS_Racing:public GameState
{
public:
GS_Racing() {}
~GS_Racing() {}

IDERV_GAME_STATE
HELPER_FUNC_DO

static GS_Racing* getInstance() { return &mGS_Racing; }

private:
static GS_Racing mGS_Racing;

USC_lib::CarLoader car;
Ogre::SceneNode *_ground;
Ogre::Entity *_groundEnt;

/*NxOgre::World *_world;
NxOgre::Scene *_scene;*/
};

#endif //__GS_RACING_H__

betajaen

24-05-2007 02:39:04

Are you including it in every file like that? Because you shouldn't, I notice Ogre.h isn't included in there. You should put the NxOgre.h next to it.

It'll probably do squat, but there isn't any reason why it's doing that.

Dirso

24-05-2007 02:47:37

Actually, it's the only file I use this. Ogre.h is included in GameState.h, that's why it's not there.

I tried to use like this:
#ifndef __USE_NX_OGRE_H__
#define __USE_NX_OGRE_H__
#include "NxOgre.h"
#endif //__USE_NX_OGRE_H__


Still no luck :(

Dirso

24-05-2007 03:17:20

I know I shouldn't, but I changed line NxOgreError.h(36) from DEBUG = 3, to NXDEBUG = 3,
It also misses a ';' in the end of line NxOgrePhysXDriver.cpp(206) to compile it in Release mode.

The change I made will become bad in anyway?

betajaen

24-05-2007 10:02:18

No. It's a stupid bug, that shouldn't of existed in the first place. Thanks for the heads up.

danharibo

24-05-2007 16:51:46

Is it possible to set the material using the Params system?

betajaen

24-05-2007 16:54:25

To the shape?

new WhateverShape(...., "material: myMaterialName");

danharibo

24-05-2007 17:09:45

To the shape?

new WhateverShape(...., "material: myMaterialName");
As in a Texture material.

betajaen

24-05-2007 17:22:57

Through the entity?

mBody->getEntity()->setMaterial("blue-green-cake-texture-035")

danharibo

24-05-2007 18:12:22

Through the entity?

mBody->getEntity()->setMaterial("blue-green-cake-texture-035")

I can't, it crashes the game because the pointer isn't Valid.

betajaen

24-05-2007 18:15:38

And your body creation code uses a mesh, and you can see the body on the screen with it's mesh?

That's impossible!

danharibo

24-05-2007 18:27:05

And your body creation code uses a mesh, and you can see the body on the screen with it's mesh?

That's impossible!
Yes, so why is it crashing then?

betajaen

24-05-2007 19:22:52

A sub-space inter-dimensional rift is in your house, making the Body into a quantum state, where there is and isn't an Entity at the same time, and by looking at it, the quantum state collapses and points at a random thing. Of course we could just have a peak before it notices, but that isn't fun is it?

Or in other words - I don't know. ;)

danharibo

24-05-2007 20:06:38

A sub-space inter-dimensional rift is in your house, making the Body into a quantum state, where there is and isn't an Entity at the same time, and by looking at it, the quantum state collapses and points at a random thing. Of course we could just have a peak before it notices, but that isn't fun is it?

Or in other words - I don't know. ;)
NOOOOOOOOOOOOOOOOOOOO[/vader]
If i showed you my constructor code, and the lines after it, could you tell?

betajaen

24-05-2007 20:12:50

I may.

danharibo

24-05-2007 20:58:52

mScene = mPhysScene;
pBody = mScene->createBody(MeshName, new ConvexShape(CollName), Pos, "mass: 4000");
pBody->setCMassOffsetLocalPosition(Ogre::Vector3(0,-2,3));
pBody->setName("TractorOne"); //THIS MIGHT CAUSE A CRASH WITH MULTIPLE VEHICLES - READ ME

//mWheelSet = WheelSet::createFourWheelSet(mBody, Vector3(-0.5f, -0.1f, 1.25f), Vector3(0.5f,-0.1f,-1.25f), 0.25f);
mWheelSet = new NxOgre::WheelSet();
mMotor = new Motor("Motor", mScene, &mWheelSet->Drive);
mWheelSet->attachDriveShaft(mMotor);
pBody->getEntity()->setMaterialName("TM190");
//OverideMaterial("Examples/EnvMappedRustySteel");

betajaen

24-05-2007 21:16:23

What's up with the setName comment? The name of the body is generated from the mesh file name, and a random number.

Your unlikely to get naming conflicts if you use it rather than "TractorOne", "TractorTwo", etc.

I'm grasping at straws here, but remove that line and see what happens, and move pBody->getEntity()->setMaterialName("TM190"); just underneath of creating the body.

danharibo

24-05-2007 21:38:08

Still Crashes.

betajaen

24-05-2007 21:54:14

Will you run this for me?

std::stringstream ss;
ss << "MeshName-> '" << MeshName << "'" << std::endl
<<"Node ->" << pBody->getNode() << std::endl
<< "Entity ->" pBody->getEntity();
NxDebug(ss.str());


Paste it, just after creating the pBody.

The results will be in your NxOgre log file, will you find it in there, and paste the contents for me?

danharibo

24-05-2007 22:52:02

I get an error about something being missing in NxOgre.dll

betajaen

24-05-2007 23:01:29

What error?

danharibo

24-05-2007 23:17:27

betajaen

24-05-2007 23:43:08

Bizzare, before you replace NxDebug with "std::cout << ss.str() << std::endl;"

Are you 100% sure that:

- The Headers in your Application are pointed to the NxOgre 0.9 SVN?
- The library folder in your Application is pointed to the NxOgre 0.9 SVN?
- You've copied the NxOgre_d.dll/NxOgre.dll from NxOgre/lib/ into your application folder?

Double Check, it may be the reason for your entity error.

kungfoomasta

25-05-2007 00:51:45

Just to clarify, your code:


std::stringstream ss;
ss << "MeshName-> '" << MeshName << "'" << std::endl
<<"Node ->" << pBody->getNode() << std::endl
<< "Entity ->" pBody->getEntity();
NxDebug(ss.str());


You want to include the Node and Entity address in the string? I would think you want getNode()->getName(), getEntity()->getName(), but maybe you are interested in seeing the pointer's address.

betajaen

25-05-2007 01:16:30

Yep. If mNode or mEntity wasn't used they'd be 0.

danharibo

25-05-2007 16:25:36

.\Vehicle.cpp(18) : error C2146: syntax error : missing ';' before identifier 'pBody' MSVC really hates me.

danharibo

26-05-2007 14:59:19

Yay! Fixed.

betajaen

26-05-2007 18:23:30

You closed the subspace inter-dimensional rift then?

betajaen

30-05-2007 22:00:00

Cloth!



There it is, implemented.

mScene->createCloth("Cloth1", Vector3(0,10,0), "mesh-material: nx.flag, width:10, height:2");

NickM has also given me his Ogre Mesh to ClothMesh code as well, so I'll be putting that in, allowing closed or semi-closed cloth bodies.

SoftShapes would be the next thing on the list, but I kind of promised to implement CCD and Groups next. ;)

ghiboz

30-05-2007 22:13:23

congrats!
very good work!!

Pottej

30-05-2007 23:55:47

Nice one Betajaen! Looking forward to playing around with it!

Any idea when your next commit will be?

betajaen

31-05-2007 00:04:43

Probably a week and a half, once I get CCD and groups working.

daedar

31-05-2007 08:04:39

Wow! I played with PhysX's demo and cloth is certainly one of the most impressive feature! So that's really a good work betajaen!

ghiboz

31-05-2007 09:10:34

Probably a week and a half, once I get CCD and groups working.

can I ask you a thing?
when you release the new Nx, you can create a new topic? that here is a big chaos!

thanks! :wink:

luis

31-05-2007 10:35:29

i'm using the lastest version (revision 23 i think) and it works just perfect :)

Probably a week and a half, once I get CCD and groups working.

ok, i'll submit a patch to fix the bug in the wheel postion so it gets commited in the next revision....

If anyone here wants, i could post the patch here so everyone making car games (seems i am not the only one here!) test the new changes.

ghiboz

31-05-2007 12:34:55

i'm using the lastest version (revision 23 i think) and it works just perfect :)

Probably a week and a half, once I get CCD and groups working.

ok, i'll submit a patch to fix the bug in the wheel postion so it gets commited in the next revision....

If anyone here wants, i could post the patch here so everyone making car games (seems i am not the only one here!) test the new changes.

i want!!
ehehe
thanks to you! :wink:

betajaen

31-05-2007 18:17:55

Cloth Part 2 with video



Now with Cloth specific RayCasting and correct Bounding Boxes.

ClothRayCaster* mCaster = new ClothRayCaster(mScene);
if (mCaster->castAllCloths(Vector3(10,10,10), Vector3(0,1,0))) {
ClothVertex vertex = mCaster->getClothVertex();
vertex.setVelocity(...);
}
delete mCaster;

Xed

31-05-2007 19:49:28

COOL!
8)

betajaen

01-06-2007 12:15:30

In Video and in Colour!

jchmack

01-06-2007 13:46:27

lol

betajaen

01-06-2007 14:42:09

Now with metal deformation...

Caphalor

01-06-2007 17:22:04

I think you are bored if I say "awesome" or "great". Hmmm, I think "stunning" would be an idea. :D
I'm waiting for the next SVN Commit, then I will update to 0.9 (I finally decided to wait).

betajaen

01-06-2007 18:01:49

NxOgre 0.9-24

0.9-24
- Implemented a system that I hope, that in the future any forum posts will not conclude in installing the SystemSoftware.
- Finished wrapping materials
- Cloth Implemented
- Created Cloth Class. (Partially incomplete, parameters of functions use PhysX style arguments than Ogre ones).
- Created ClothRayCaster Class.
- Created ClothVertex Class. (Incomplete)
- Added helper code to generate a flat plane of cloth.
- Added getCloths() and getNbCloths() to Scene.
- Added createCloth() and destroyCloth() to Scene.
- Added two constructors to the Pose Class.
- Added getActors() and getNbActors() to Scene.
- Fluid classes prototyped.
<Betajaen>

- Created JointSet2 (Spherical, Fixed and Prismatic)
<Pottej:http://www.ogre3d.org/phpBB2addons/viewtopic.php?p=25576#25576> 26-May-2007




Instructions with Cloth

To create a simple sheet of cloth, like a flag:
mScene->createCloth("This is my cloth name", Vector3(0,10,0), "width:2, height: 3, mesh-material: nx.flag");

The material used with a sheet of cloth requires to parameters, "cull hardware" and "cull software", like so:

material cloth_material_example
{
technique
{
pass
{

depth_bias 1
cull_hardware none
cull_software none

texture_unit
{
...
}
}
}
}


Materials with pressuirsed and metal cloth are as normal.


To create a pressurised piece of cloth like a balloon. You need to supply a closed mesh. The mesh should be clean, without any submeshes. There is a filtering algorithm in the code which removes all duplicated vertices, but don't be lazy and rely on the code to do it for you.


ClothParams cp("mesh-material: nx.sphere, thickness: 0.25, stretching-stiffness: 0.7, solver-iterations: 3, pressure: 1.0, friction: 0.5");
cp.flags |= NX_CLF_BENDING;
cp.flags |= NX_CLF_SELFCOLLISION;
cp.flags |= NX_CLF_COLLISION_TWOWAY;
cp.flags |= NX_CLF_PRESSURE;

mScene->createCloth("my pressurised cloth", "meshname.mesh", Vector3(0,10,0), cp);



To create "metal" or deformable cloth then you attach it to an Actor. When it deforms it will only look like it has deformed, the collision model will remain the same.

The shape you pass on, is what roughly the cloth looks like. It should be at least twice as small as the cloth mesh.

ClothParams cp("mesh-material: nx.sphere, solver-iterations: 3");
cp.flags |= NX_CLF_BENDING;
cp.flags |= NX_CLF_COLLISION_TWOWAY;
cp.flags |= NX_CLF_SELFCOLLISION;


Actor* mActor = mScene->createActor("clothactor", new SphereShape(0.25f), Vector3(0,2,0), "Mass: 10");
Cloth* mCloth = new Cloth("Cloth", "nx.sphere.50cm.mesh", mScene, Vector3(0,2,0), cp);
mCloth->attachToCore(mActor->getNxActor(), 10, 0);


You should read what the arguments are for before playing with them. The NxCloth class method comments are partically useful.

I wish to note that the cloth method arguments will change in the future, they are still using NxVec3, and NxActor instead of the traditional NxOgre ones.

Before I go, I wish to thank NickM for his help and making me realise why it was creating a polygon soup. I believe you should do the same.

Xed

01-06-2007 18:22:41

http://www.nxogre.org/screens/cloth3.avi

I can't loaded it!!!
:(

betajaen

01-06-2007 18:38:14

Use VLC to view it with.

alejandro

02-06-2007 00:28:23

how can i see the debug mode in the 0.9 version ??

betajaen

02-06-2007 00:56:37

There isn't one, you should use the RemoteDebugger instead. Go back a few pages for the instructions.

Pottej

02-06-2007 11:50:32

Sweet work mate - love your videos (mainly their titles)!

By the way... you are still missing that semi-colon in the PhysXDriver.cpp


<< std::endl << std::endl << " -> Error Code: PhysX SDK is unavailable. Please install the PhysX System Software." << std::endl


:)

betajaen

02-06-2007 11:53:45

Fixed, and thankyou! Expect some more funny movie posters in the future.

Pottej

02-06-2007 11:57:44

Anyone else get:


..\source\NxOgreCloth.cpp(474) : error C2065: 'scene' : undeclared identifier
..\source\NxOgreCloth.cpp(474) : error C2227: left of '->getPhysicsSDK' must point to class/struct/union/generic type
type is ''unknown-type''
..\source\NxOgreCloth.cpp(474) : error C2228: left of '.createClothMesh' must have class/struct/union
..\source\NxOgreCloth.cpp(585) : error C2227: left of '->getPhysicsSDK' must point to class/struct/union/generic type
type is ''unknown-type''
..\source\NxOgreCloth.cpp(585) : error C2228: left of '.createClothMesh' must have class/struct/union


Seems to be a problem with:


mClothMesh = scene->getPhysicsSDK().createClothMesh(MemoryReadBuffer(buf.data));



should it get the scene from the owner first? This error only happens in release so I guess it was easy to slip by.

betajaen

02-06-2007 12:09:49

Whoops. scene should be mOwner.

betajaen

03-06-2007 00:25:50

Ogre Jelly!



I just wanted to point out how easy is cloth to implement, and how forgiving on how bad of a mesh you throw at it.

I made the mesh in my 3d modeller in about two minutes, I didn't optimise it. I saved it as a .obj, and imported it into Gile of all things, and used walabers Ogre Mesh exporter. Making sure that the mesh version is the Dagon kind. I hex edited the material name to something else, and just shoved it into the sandbox.

It fell with the grace that a 30 metre piece of jelly would do in real-life; bounced and wobbled.

I tell you what though, I cannot wait to see what you guys do with it. :D

ELO

03-06-2007 14:25:25

I am porting my app from NxOgre 0.4 to 0.9.
My app will crash when deleting World after World->destroyScene.
This is because my characters (Scene->createCharacter) are not destroyed with the Scene.
My workaround is to remove them all (Scene->destroyCharacter) before World->destroyScene.
Not a big problem, but this behavior changed since version 0.4 and it took me some time to find it out. Maybe this helps somebody.

Another point: 0.9.24 compiles well in release.
In debug-mode there is an compiler-error in NxOgreCloth.h:
struct NxExport ClothVertex {
Cloth* cloth;
NxU32 vertex;

Ogre::Vector3 getGlobalPosition() const;
void setGlobalPosition(const Ogre::Vector3& worldPosition);
void attachToShape(Shape*, const Ogre::Vector3& localPosition);
void attachToWorld(const Ogre::Vector3& worldPosition);
void free();


The error is "not enough parameter für macro free". I guess this is because of the ogre-memory-manager.
I use this for detecting memory leaks, therfore i defined OGRE_DEBUG_MEMORY_MANAGER 1

betajaen

03-06-2007 14:35:54

Interesting you've found a bug and a design problem there. It's removing the characters once the scene has been destroyed, because I defined a global character controller/container class which is handled by World, and deleted when World is destroyed. For it to behave properly there should be a list of characters of per scene than an unordered list of them.

Your solution is a bypass but if the design was correct you wouldn't have to do so.


Interesting, I work in Debug Mode all the time. I don't even bother checking if the code works in Release anymore (hence the odd post popping up about syntax errors!).

I'll turn the Memory Manager back on, and see what it's moaning about this time.


In the mean time, good luck with your porting ;)

ELO

03-06-2007 20:02:52

I started porting because we found no solution for this problem:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=3591
Now with 0.9 it seems to be the same problem, after destroyScene and createScene for the second time, the app crashes in nxogrecharacter.cpp, after a character is created:

void Character::simulate(float t) {

NxVec3 moveVector, gravity;
moveVector.zero();
mScene->getNxScene()->getGravity(gravity);

// Calculate next movement.
mMoveVectorController->move(moveVector, mNextMovementDirection, mDirection, gravity, t, this);

// Move it
mCharacter->move(moveVector, mMove_ActiveGroupsMask, mMove_MinDistance, mCollisionFlags, mMove_Sharpness, &mMove_GroupMask);

Drakon

04-06-2007 01:24:03

Nice betajaen :) Thanks for your hard work.

http://www.youtube.com/watch?v=RLpIynDMxpM - quick test : "Pumpkin crushing" ;)

betajaen

04-06-2007 09:49:09

Aww, that poor pumpkin. What did he ever do to you!?

alejandro

04-06-2007 17:57:44

the jump is no implemented yet?

alejandro

04-06-2007 18:24:46

hey betajaen , can you give us a little words , to how to use the character controler, i see that this version have more stuff!!!,

can you tell me, if i can detect the colision of my character with other body in the scene with the reporters ?

how works the NxControllerAction CharacterController::onShapeHit ?

betajaen

04-06-2007 20:44:09

My poor Welsh flag



Apart from the texture coordinates being a little iffy and brown, I say tearing is now working. ;)

@alejandro

You should look at the BaseCharacterHitReport class and how it is implemented, and fired upon in the CharacterController class.

alejandro

07-06-2007 19:56:52

when you put this "

mWorld->getCharacterController->addHitReport(new myHitReport);
in the NxOgreCharacterHitReport.h
"

where is the function addHitReport ?
or how can i make my own hit report ?


i add this function to you code , and now i create my own hit reporter :

void CharacterController::addHitReport( CharacterHitReport* mBaseHitReport ){
mHitReports.insert(mBaseHitReport);
}

ricardo_arango

07-06-2007 20:11:23

If I create the an scene like this

world->createScene("Main", sceneManager);

I get an access viol;ation error

If i create it like this:

world->createScene("Main", sceneManager, , "gravity: yes, floor: yes");

I don't.

Haven't looked at the code so I don't know exactly why it does it.

betajaen

07-06-2007 21:01:54

Does this work?

world->createScene("Main", sceneManager, "")

alejandro

07-06-2007 23:01:18

Finnaly the character is detecting when he is touching a body that is part of a group, thanks betajaens.

i am using the reporters hit .

but i am using the groups like this

the canon->getNxActor()->setGroup(arboles);

and in my reporters_hit class i do this
if ( h.shape->getActor().getGroup() == 10 )
(10 is the number of the group)

but , i cant found how to use with NxOgre::Group

how to create a group with this new version ?
in 0.4 it was like this : m_Scene->createGroup("grupoarboles");

but the Scene hasnt this method yet . or there is another form?

betajaen

07-06-2007 23:07:48

Sadly, Groups haven't been implemented yet. Obviously your assigning them to the Actors manually and getting them, so it works. With no shiny wrapper available, anything such as CollisionFlags or Filtering, would have to be done through the PhysX interface.

ELO

08-06-2007 17:56:58

I have completed porting our game from 0.4 to 0.9, here ist some feedback.
It is now working as good as with NxOgre 0.4 except collision detection.

Creating a (dynamic) body:
The body will remain static, if the string "static: no" is used.
If no params are given, the body is dynamic, but the app will crash.
Only this parameter seems to work:
createBody(mesh, new NxOgre::SphereShape(radius),position, "kinematic: yes");

character movement:
CharacterMovementVectorController is a good solution, works perfectly for me.


Collision detection (character)
CharacterHitReport ist working for me. It was not easy, to find the correct usage, so this example maybe helpful:

class myHitReport : public CharacterHitReport {
virtual Response onActorHit(Character*, Actor*, Shape*, Group*);
virtual Response onCharacterHit(Character*, Actor*, Shape*, Group*);
};
mHR = new myHitReport();
mWorld()->getCharacterController()->mHitReports.insert(mHR); //mHitReports now public!

//get the names of character and actor (don't forget to assign them, when you create these):
Response myHitReport::onActor(Character* c, Actor* a, Shape* s, Group* g, const NxControllerShapeHit& sh) {
string charactername = c->getNode()->getName();
string actorname = a->getName();


Collision detection ("normal" bodies)
I have no Idea how to do this. Maybe somebody else can post some examples here.


Re-Init level:

This is my biggest problem!
I post some test-coe, maybe it helps to find a solution:

mPhyScene = mWorld->createScene("level01", mSceneMgr, "gravity: yes, floor: yes");
NxOgre::Character* mPlayer = mPhyScene->createCharacter("testchar_1", Vector3(20,1,20), "type: box, dimensions: 2 2 2");
mPlayer->attachMesh("test1.mesh");
//mPhyScene->destroyCharacter( "testchar_1" ); this makes no difference
mWorld->destroyScene("level01");
mPhyScene = mWorld->createScene("level02", mSceneMgr, "gravity: yes, floor: yes");
mWorld()->simulate(dt); //crash

Pottej

08-06-2007 18:09:34

Thanks ELO I am working on the same thing right now! I don't know how to help with your character deletion, although I would be very keen to see a solution.

Betajaen if the current solution for adding hit reports is to make mHitReports public can you please update that with your next SVN commit.

Cheers :)

betajaen

08-06-2007 18:28:41

Character Deletion bug is a design fault my half. I have a fix in mind for it. I just have to write the code.

@ELO

Collision detection with normal actors/bodies is the same as your CharacterHitReport; myHitReport::OnActor. Depending on the response you can vary from a simple touch of a body (and launch a function in a class) or specifying the response to walk through, and you have a Trigger for Characters only. :D

Obviously. I have a big thing planned for this, I just haven't had the time yet.

ELO

08-06-2007 19:15:03

This sound good to me, i would like to implement more of your new features to our game.

Collision detection character/normal actor is now working.
What about collision normal actor/normal actor ?

jchmack

13-06-2007 18:31:32

Im trying to get 0.9-24 to work and it doesnt seem to like the new cloth stuff...


1>NxOgreCloth.cpp
1>c:\documents and settings\desktop\game4\nxogre\include\nxogrecloth.h(220) : warning C4003: not enough actual parameters for macro 'free'
1>c:\documents and settings\desktop\game4\nxogre\include\nxogrecloth.h(220) : error C2143: syntax error : missing ';' before '.'
1>c:\documents and settings\desktop\game4\nxogre\include\nxogrecloth.h(220) : error C3254: 'NxOgre::ClothVertex' : class contains explicit override 'instance' but does not derive from an interface that contains the function declaration
1>c:\documents and settings\desktop\game4\nxogre\include\nxogrecloth.h(220) : error C2838: 'instance' : illegal qualified name in member declaration
1>c:\documents and settings\desktop\game4\nxogre\include\nxogrecloth.h(220) : error C2238: unexpected token(s) preceding ';'

refering to this line:

void free();

EDIT:

I think that it is conflicting with:
# define free(ptr) ::Ogre::MemoryManager::instance().dllocMem(__FILE__,__LINE__,__FUNCTION__, ::Ogre::m_alloc_free, ptr, gProcessID)

but i tried to change the problem line to free2 just to see if i can get a compile and i get:


1>LINK : C:\Documents and Settings\Desktop\game4\NxOgre\\lib\NxOgre_d.dll not found or not built by the last incremental link; performing full link
1> Creating library C:\Documents and Settings\Desktop\game4\NxOgre\\lib\NxOgre_d.lib and object C:\Documents and Settings\Desktop\game4\NxOgre\\lib\NxOgre_d.exp
1>Embedding manifest...
1>Performing Post-Build Event...
1>The syntax of the command is incorrect.
1>Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."

betajaen

13-06-2007 18:43:37

Change it to "freeVertex".

jchmack

13-06-2007 18:59:39

i got it...

remove this from project->properties->build events -> post build events

copy "$(TargetPath)" ""$(SolutionDir)/tutorials/""

you and your tutorials folder :lol:

normally this goes away if i have a tutorials directory there though. Meh no need since no tutorials for 0.9 out yet. Thx alot betajaen.

betajaen

13-06-2007 19:33:28

Useful for me though. Since I have a tutorials folder.

And how else am I supposed to test if our beloved works or not. ;)

jchmack

13-06-2007 20:48:04

for anyone wanting to use the release version of 0.9-24:

1)there are a couple of lines that dont know what scene is:

change:
//Original
//mClothMesh = scene->getPhysicsSDK().createClothMesh(MemoryReadBuffer(buf.data));

to
mClothMesh = mOwner->getNxScene()->getPhysicsSDK().createClothMesh(MemoryReadBuffer(buf.data));

2) Missing semicolon at the end of this line:

Line 210 in NxPhysXDriver.cpp

s << "Unable to start the PhysX SDK!" << std::endl << std::endl << "Please refer to the developer or publisher's website or support line for information relating to the errors detailed."
<< std::endl << std::endl << " -> Error Code: PhysX SDK is unavailable. Please install the PhysX System Software." << std::endl;<-RIGHT HERE!!!

jchmack

13-06-2007 22:11:38

I know that Groups arent a part of 0.9 yet but does anyone have any experience doing it manually?

im trying to stop my projectiles from colliding with one another:

i used to have this:
group *Projectiles = mScene->createGroup("Projectiles");
Projectiles->noCollisionsWith(Projectiles);
and for each projectile i create:
mBody->setGroup(mScene->findGroup("Projectiles"));

i belive the 0.9 temporary equivalant should be this
mScene->getNxScene()->setGroupCollisionFlag(1,1, false);
and when i make a projectile:
mBody->getNxActor()->setGroup(1);

but this doesn't keep them from colliding... Any ideas?

alejandro

14-06-2007 23:58:48

how ,can i use the setPosition method of the character,

i am using like this

Personaje->setPosition(Ogre::Vector3(0,100,0));

but it dont work :evil:

i am using 0.9

HexiDave

15-06-2007 00:06:08

Useful for me though. Since I have a tutorials folder.

And how else am I supposed to test if our beloved works or not. ;)



I have nothing useful to add to this, I just wanted to note that your new icon is awesome.

betajaen

15-06-2007 00:41:18

Eh!!!

I was going to animate it; Make the cube hover up and down so slightly, but it'd go over the avatar file size limit and I don't have any application that would do it for me. :?

HexiDave

15-06-2007 01:25:37

PM me a link to the pictures and I'll do it :D

jchmack

15-06-2007 01:40:39

I know that Groups arent a part of 0.9 yet but does anyone have any experience doing it manually?

im trying to stop my projectiles from colliding with one another:

i used to have this:
group *Projectiles = mScene->createGroup("Projectiles");
Projectiles->noCollisionsWith(Projectiles);
and for each projectile i create:
mBody->setGroup(mScene->findGroup("Projectiles"));

i belive the 0.9 temporary equivalant should be this
mScene->getNxScene()->setGroupCollisionFlag(1,1, false);
and when i make a projectile:
mBody->getNxActor()->setGroup(1);

but this doesn't keep them from colliding... Any ideas?


do i have to create the group or something?

From what im reading in physx what i have should work...?

Also i cant do kinematics. Does anyone have any experience with kinematics in 0.9-24?

im trying to use this:

ActorParams Params;

Params.setToDefault();

if(Kinematic)
Params.kinematic=true;

Pottej

15-06-2007 09:09:24


I have nothing useful to add to this, I just wanted to note that your new icon is awesome.


Eh STEVE! was better.... just.

betajaen

15-06-2007 10:28:50

do i have to create the group or something?

Nope, not at all. The Group concept in older versions of NxOgre assigned names, to make sure the user didn't go over the 31 Group limit and wrap some of functions behind it. Nothing more really.

But I noticed that your setting it to the Actor rather than the Shape itself. There isn't a system in place to do it at the moment, so you'll have to do it the yucky way:

NxShape *const* s = mBody->getNxActor()->mActor->getShapes();
s->setGroup(1);


Also i cant do kinematics. Does anyone have any experience with kinematics in 0.9-24?

Again missing feature. Just raise the flag when it has been created:

mBody->raiseBodyFlag(NX_BF_KINEMATIC)


@Pottej

Eh! Steve. Is an actual painting I painted a few years back. It's from the "Eh! Steve" character from Homestarrunner.com. I've been meaning to send in a photograph, but I've never got around to it.

But I think it's time to change to the Fonz again.

<~Creatine~>

15-06-2007 12:35:00

Hello, I made a simple contact reporting (stolen from 0.4):

NxOgreScene.h:

class NxExport Scene
{
...
public:
void createContactPair(Body *a, Body *b, bool _start = true, bool _touch = true, bool _end = true);
...


NxOgreScene.cpp:

void Scene::createContactPair(Body *a, Body *b, bool _start, bool _touch, bool _end)
{
NxU32 f;

if (_start) f = NX_NOTIFY_ON_START_TOUCH;
if (_touch) f |= NX_NOTIFY_ON_TOUCH;
if (_end) f |= NX_NOTIFY_ON_END_TOUCH;

mScene->setActorPairFlags(*a->getNxActor(), *b->getNxActor(), f);
}


NxOgreContactReporter.h:

#ifndef NXOGRE_CONTACT_REPORTER_H
#define NXOGRE_CONTACT_REPORTER_H

#include "NxOgre.h"

namespace NxOgre
{
class NxExport contactReporter : public NxUserContactReport
{
public:
virtual void onStartTouch(Body *a, Body *b) = 0;
virtual void onTouch(Body *a, Body *b) = 0;
virtual void onEndTouch(Body *a, Body *b) = 0;

void onContactNotify(NxContactPair& pair, NxU32 events);
};
}

#endif


NxOgreContactReporter.cpp:

#include "NxOgreStable.h"
#include "NxOgreContactReporter.h"

namespace NxOgre
{
void contactReporter::onContactNotify(NxContactPair& pair, NxU32 events)
{
if (!pair.actors[0] || !pair.actors[1]) return;

Body *a = static_cast<NxOgre::Body*>(pair.actors[0]->userData);
Body *b = static_cast<NxOgre::Body*>(pair.actors[1]->userData);

if(events & NX_NOTIFY_ON_START_TOUCH)
{
onStartTouch(a, b); return;
}

if(events & NX_NOTIFY_ON_TOUCH)
{
onTouch(a, b); return;
}

if(events & NX_NOTIFY_ON_END_TOUCH)
{
onEndTouch(a, b); return;
}
}
}


example:

Scene* aScene;
Body* bodyA;
Body* bodyB;

bodyA = aScene->createBody("ball.mesh", new SphereShape(1), Ogre::Ogre::Vector3(10, 0, 0), "mass: 2");
bodyA->setName("myBodyA");

bodyB = aScene->createBody("ball.mesh", new SphereShape(1), Ogre::Ogre::Vector3(-10, 0, 0), "mass: 2");
bodyB->setName("myBodyB");

aScene->createContactPair(bodyA, bodyB, true, false, false);

class Collision : public contactReporter
{
void onStartTouch(Body *a, Body *b)
{
if(a->getName() == "myBodyA" && b->getName() == "myBodyB")
bodyA->setGlobalPosition(Ogre::Vector3(0, 0, 0));
}

void onTouch(Body *a, Body *b)
{
return;
}

void onEndTouch(Body *a, Body *b)
{
return;
}
}myContactReport;

aScene->getNxScene()->setUserContactReport(&myContactReport);


I hope for to this helps somebody while Betajaen writes the serious contact report.

betajaen

15-06-2007 13:24:38

Thankyou. It should be a good base for my ContactReport. :D

jchmack

15-06-2007 20:01:41

im trying to do raycasts in 0.9:


RayCaster* mRayCaster;

mRayCaster = new RayCaster(Vector3(0,0,0), Vector3(0,0,0), 1000, RayCaster::RCT_CLOSEST, mScene);

mRayCaster->setOrigin(Start);
mRayCaster->setDirection(End-Start);
mRayCaster->setMaxDistance(Start.distance(End));

if (mRayCaster->castShape(RayCaster::AF_NONE))
return mRayCaster->getClosestRaycastHit().mWorldImpact;
else
{
cout << "default raycast" << End.x << ' ' << End.y << ' ' << End.z << endl;
return End;
}


but mRayCaster->castShape(RayCaster::AF_NONE) NEVER returns true:

it always ends up using the default (ogre based) raycast which i am trying to get rid of.

betajaen

15-06-2007 21:29:48

Try normalizing the direction.

alejandro

16-06-2007 17:48:38

with the hitReporters, i am detecting when the character collide with something , but, when my character collide with some body that is up , he dont call the hit report.

when he collide in the front , and by the sides, its works. but in the up side, of the character . it do not call the reporters.

was happening ?

betajaen

16-06-2007 18:21:52

For example; if a crate (a Body/Actor) falls on the characters head?

alejandro

16-06-2007 20:50:58

yep, i asume ,

my problem is when my character jumps and touches something up to him
. he stops , but never call the hit reporters .

betajaen

16-06-2007 21:01:39

But is the thing he is bumping his head on is static or dynamic?

alejandro

16-06-2007 21:35:03

is static .

alejandro

17-06-2007 00:16:01

in ageia documentation says :

// We only allow horizontal pushes. Vertical pushes when we stand on dynamic objects creates
// useless stress on the solver. It would be possible to enable/disable vertical pushes on
// particular objects, if the gameplay requires it.


how can i enable ?

jchmack

17-06-2007 00:36:02

in ageia documentation says :

// We only allow horizontal pushes. Vertical pushes when we stand on dynamic objects creates
// useless stress on the solver. It would be possible to enable/disable vertical pushes on
// particular objects, if the gameplay requires it.


how can i enable ?


"Vertical pushes when we stand on dynamic objects creates useless stress on the solver"

I believe that it means dynamic only. Are you trying to get you character to just not pass through the roof? or are you trying to make him move the roof or something?

alejandro

17-06-2007 00:46:05

nop,

more clear :

when he jumps ,he stop , because he find a cube , up there,
but the system doesnt call the hit Reporters class.

when i put the cube a little down , and the character collide with the front part, or the sides, he calls the hit reporteres class .

so my quiestion , why he doesnt call the Hit reporters , when he collide with up side?

danharibo

17-06-2007 12:25:54

The code in the tutorials is out of date, How do i create a Free Joint in the new code?

<~Creatine~>

18-06-2007 09:37:00

The code in the tutorials is out of date, How do i create a Free Joint in the new code?
try this:

NxOgre::Scene* aScene;

NxJoint* YourClass::createJoint(NxActor* actor0, NxActor* actor1)
{
NxRevoluteJointDesc revDesc;

revDesc.actor[0] = actor0;
revDesc.actor[1] = actor1;

return aScene->getNxScene()->createJoint(revDesc);
}

NxJoint* joint_;
joint_ = createJoint(body0->getNxActor(), body1->getNxActor());

gugus

18-06-2007 09:47:39

I know it's a little off-topic but what is missing in 0.9-24?What did you plane to add for 1.0?And when 1.0 will be release?

betajaen

18-06-2007 15:13:03

NxOgre 0.9-25


0.9-25
- Rewrote the ConvexShape cooking code, which now removes any duplicated vertices automatically.
- Any mesh cooked in debug mode, will use the meshName's filename as a prefix.
- Precooked (NXS) MeshShapes and ConvexShapes can be used instead of an Ogre::Mesh.
- Fixed missing secondary constructor in CubeShape.
- Added createDeformableActor method in Scene
- Fixed texture coordinates and normals in cloth meshes (Still buggy).
- Tearing of cloth implemented (Buggy with new texture coordinates.)
- Soft Body class prototyped. *
- Made Luis' new wheel code compatible with PhysX 2.6.x
- General cleanup of Actor and Body classes.
- SceneController Class addded.
- Scene rewired to run from SceneController class.
- Experimental SuperFixedSceneController class implemented. *
- Fluid System added. *
- Raw (8 and 16-bit) heightfields. *
- At popular demand the DebugRenderer is back. +
<Betajaen>

- Fixed some syntax bugs for Linux
- Removed wheelContact line
<Vinvin:http://www.ogre3d.org/phpBB2addons/viewtopic.php?p=25888>

- Rewrote the wheel heading and pitch code
<Luis>


* Activation of this feature requires the compiler flag NX_UNSTABLE in NxOgreStable.h to set to 1.
+ To compile NxOgre with the DebugRenderer set the compiler flag NX_USE_DEBUG_RENDERER_API in NxOgreStable.h to 1

jchmack

18-06-2007 19:14:59

Sounds great!

I especially love the return of the debug renderer =).

HexiDave

18-06-2007 19:22:44

I especially love the return of the debug renderer =).

AGREED! I finally got the remote debugger rolling, but it's a bit ponderous to get my geometry to match with the internal geometry if I have no real reference in-between. Much obliged, sir!

jchmack

18-06-2007 19:49:46

i think i got an early bug.

mScene->getNxScene()->setGroupCollisionFlag(1,1, false);
crashes because:

mScene->getNxScene() returns a null pointer.

NxOgreScene.cpp

Scene::Scene(const NxString& name, Ogre::SceneManager* s, World* world, SceneParams p) : mName(name), mSceneMgr(s), mOwner(world) {

mOwner->_registerScene(mName, this);

mDescription.setToDefault();
_paramsToDescription(p);

if (p.time_step_method == p.CN_VARIABLE)
mSceneController = new VariableSceneController(this);
#if (NX_UNSTABLE == 1)
else if (p.time_step_method == p.CN_SUPER_FIXED)
mSceneController = new SuperFixedSceneController(this);
#endif
else
mSceneController = new FixedSceneController(this);

mSceneController->setTiming(mDescription, p.max_timestep, p.max_iter,0);

mScene = mOwner->getSDK()->createScene(mDescription);

if (!mScene) {
std::stringstream ss;
ss << "Scene creation of '" << name << "' failed." << std::endl;
NxThrow_Error(ss.str());
return;
}

mSceneController->init(mScene);

// SceneParams -> Floor: Yes
if (p.floor) {
addFloor();
}

_createDefaultMaterial(p.default_material_restitution,p.default_material_dynamic_friction,p.default_material_static_friction);

}


i dont believe that this line
mScene = mOwner->getSDK()->createScene(mDescription);
is being called for me.

this code was just working for 0.9-24. im using release mode btw.

from my end of the code it looks pretty standard:

void game4::SetupNXOgre()
{
mWorld = new World();
mScene = mWorld->createScene("Main", mSceneMgr, "gravity: yes, floor: yes");

mSceneMgr->setFog(FOG_LINEAR, ColourValue::Black, 0.0005f, 4000,4500);
mSceneMgr->setAmbientLight(ColourValue(1,1,1));
mSceneMgr->setShadowTechnique( SHADOWTYPE_STENCIL_ADDITIVE );


//mScene->getNxScene()->setGroupCollisionFlag(1,1, false);

if(ViewReferenceGrid)
{
// create floor and reference grid
Ogre::StaticGeometry* sg;
sg = mSceneMgr->createStaticGeometry("grid");
Entity *Floor = mSceneMgr->createEntity("nx.floor.entity", "nx.floor.mesh");
Floor->setCastShadows(false);
sg->addEntity(Floor, Vector3(0,-0.01,0));

Entity *Axis = mSceneMgr->createEntity("nx.body.axis.entity", "nx.body.axis.mesh");
Axis->setCastShadows(false);
sg->addEntity(Axis, Vector3(0,0,0));
sg->build();
}

}


even with the problem line commented out it still crashes at the last }
something isnt being initialized or something.

betajaen

18-06-2007 20:49:16

Grr. I wish I tested it out before I posted the SVN. Anyway. I had a similar error, but with massive crashing on creation of the scene. I suspect it's down the SceneController logic there.

So for now, you'll have to enable the NX_UNSTABLE flag. If that doesn't work, force the Scene to use fixed (or variable) timing "time-step-method: fixed" in the params.

[Edit]

The NULL is because the SceneDescription is invalid, probably due to the SceneController.

betajaen

18-06-2007 22:02:30

There you go. A untested fix ;)

0.9-26
0.9-26
- Fixed bug with an invalid SceneDescription.
<Betajaen> 18-June-2007

betajaen

18-06-2007 23:10:21

Doh!

0.9-27
0.9-27
- Side-stepped a PhysX bug, with the flags NX_DISABLE_FLUIDS, NX_DISABLE_SOFTBODY on Windows. It seems it causes a bit of a crash when simulating.
<Betajaen> 18-June-2007


Would anyone tell me if the "speed" of the simulation of the scene seems a little "off"? It's supposed to be running roughly 60 times a second. Of course the Windows timer isn't accurate for such a thing, so it's a rough guess. The "SuperFixedSceneController" fixes this problem, but the FixedSceneController (which is the default for a Scene) uses the Windows timer. Anyhoo.

jchmack

19-06-2007 06:36:33

lol when i saw that number jump from 25 to 27 i thought you had really been working. But ill give it a test now.

edit:
seems to be working better now i havent really tested much but the body::setnode still doesn't seem to be working the way i am expecting:

method one (the one that comes with NxOgre)(doesnt work)


mBody->setNode(GetSceneMgr()->getRootSceneNode()->createChildSceneNode());

void Body::setNode(Ogre::SceneNode* node)
{
mNode = node;
}


method 2 works


mBody->createNode();

void Body::createNode()
{
if (mNode)
return;
mNode = mOwner->getSceneManager()->getRootSceneNode()->createChildSceneNode();
}


Arent they almost exactly the same? i wonder why only the second one works (for me at least). As for speed and timing issues i see none right now.

jchmack

19-06-2007 07:17:22

ok after a few more tests i have some problems lol.

I see what you are talking about (timing wise) everything seems to be going alot slower for me.

After i close my app i get an exception:

01:13:59: OGRE EXCEPTION(5:ItemIdentityException): MovableObjectFactory of type Camera does not exist in Root::getMovableObjectFactory at ..\src\OgreRoot.cpp (line 1082)

seems NxOgre is deleting a camera before ogre can or something.

I am running Release and my configuration looks like this


///////////////////////////////////////////////////////////////
// //
// Configuration //
// //
///////////////////////////////////////////////////////////////

// Report any variables in containers, that are not "locked" as
// possible leaks in the log.
// - Comment to disable, Uncomment to enable
#define NX_TREAT_POSSIBLE_LEAKS_AS_LEAKS

// Allow the DebugRenderer to be used.
// 0 - Disallow (Default) 1 - Allow
#define NX_USE_DEBUG_RENDERER_API 0

// Compile with some of the unstable parts of the NxOgre API.
// 0 - Disallow (Default) 1 - Allow
#define NX_UNSTABLE 0

betajaen

19-06-2007 09:29:38

Are you putting the Camera in any of the Nodes which NxOgre handles, an Actor, Body or Character? If so you need to un-attach the Camera before deleting mWorld and moving it to the main SceneNode.

gugus

19-06-2007 09:31:19

Sorry for beeing late,i am in exam revsion(french bac).
It sound realy great!
I hope you will continue during hollidays(if you have some of cours).

ANdys

19-06-2007 09:48:47

I got a error when i use the DebugRenderer.

VS Debug point a line in nxdebugrenderable.h
NX_INLINE NxU32 getNbLines() const { return numLines; }

void DebugRenderer::render(const NxDebugRenderable& data) {

// Render lines
NxU32 NbLines = data.getNbLines(); // <<<<<----------------------------------------------------- the problem
const NxDebugLine *Lines = data.getLines();

while(NbLines--) {
addLine(Lines->p0,Lines->p1, ((Lines->color << 8) | 0xFF));
Lines++;
}
// Render triangles
NxU32 NbTris = data.getNbTriangles();
const NxDebugTriangle *Triangles = data.getTriangles();


while(NbTris--) {
addLine(Triangles->p0,Triangles->p1,((Lines->color << 8) | 0xFF));
addLine(Triangles->p1,Triangles->p2,((Lines->color << 8) | 0xFF));
addLine(Triangles->p2,Triangles->p0,((Lines->color << 8) | 0xFF));
Triangles++;
}


// Render lines
NxU32 NbPoints = data.getNbPoints();
const NxDebugPoint *Points = data.getPoints();

while(NbPoints--) {
addLine(Points->p,Points->p, ((Points->color << 8) | 0xFF));
Points++;
}

}


I can't solve it. :cry:

betajaen

19-06-2007 10:07:34

And this is one of the reasons why I didn't want the DebugRenderer in 0.9.

I found the bug. Insert this into the beginning of "void DebugRenderer::render(const NxDebugRenderable& data)" in "NxOgreDebugRenderer.cpp"

if (&data == 0)
return;


But you should be using the RemoteDebugger it's 10 times better.

ANdys

19-06-2007 10:14:50

OK!!
Very Thank You betajaen!!

danharibo

19-06-2007 16:57:04

How can i 'Disable' An objects Collisions? I'm making a Stand for my trailers, and i don't want them to fall to the ground when they spawn.

betajaen

19-06-2007 17:40:35

Create a group and deny collisions with it. There isn't a class for it now, so you'll have to do it the hard way. But there has been a post or two recently about it - with code.

jchmack

19-06-2007 20:14:05

Are you putting the Camera in any of the Nodes which NxOgre handles, an Actor, Body or Character? If so you need to un-attach the Camera before deleting mWorld and moving it to the main SceneNode.

hmm im trying this and it is still not working...

after looking at the error again:
01:13:59: OGRE EXCEPTION(5:ItemIdentityException): MovableObjectFactory of type Camera does not exist in Root::getMovableObjectFactory at ..\src\OgreRoot.cpp (line 1082)

i believe you are destroying the camera factory somewhere in NxOgre. So later when I/Ogre calls Root::getMovableObjectFactory I get a crash.

I tested with a small test app and i get similar results.

jchmack

19-06-2007 20:47:54

And this is one of the reasons why I didn't want the DebugRenderer in 0.9.

But you should be using the RemoteDebugger it's 10 times better.


i like the remote debugger as well (especially since you can pause/replay and see from different viewpoints other than your ogre camera). But in my opinion you need a debug renderer (or something similar) so that you can see how your visual representation (Ogre) matches up with your mathematical representation (PhysX). I think its best to have both. Each has certain benifits in certain situations.

Im really glad you brought back the debug renderer though (i was about to try myself). Its always better to have more than one options. More options = more power.

betajaen

19-06-2007 21:28:31

I cannot see how. When a Body is destroyed it asks Ogre to delete the SceneNode and the contains there in. I've used the same code to do it since 0.3. You must have the Camera in one of those nodes.

See if you can comment out the destructor code in Body and see if it works then. If it is, then it's NxOgre's fault if not, it would be your code. ;)

ebol

20-06-2007 17:31:07

Hi, this might be a little offtopic, but I'm having problems with downloading latest nxOgre from SVN (from quite time actually) and I'm out of ideas what could be causing it :( And, if I remember right, I had no problems with downloading earlier revisions (the really early ones)

after calling:

svn co http://latest.nxogre.org/nxogre3/

I get this error:


svn: REPORT request failed on '/nxogre3/!svn/vcc/default'
svn: REPORT of '/nxogre3/!svn/vcc/default': 403 Forbidden (http://latest.nxogre.org)


It seems that only I'm having this problem (no one ever mention this), but I have no idea why. I cant download nx 0.6 also, the same error, but other repositorys works fine :? (like ex. ogreaddons or ogreAL)

Any hints ?

btw, its never a bad moment to say this - great work betajaen! ;) I meen it :)

betajaen

20-06-2007 17:45:24

Which SVN client are you using?

And it's never a bad moment to congratulate ones work.

ebol

20-06-2007 17:54:34

I tried 2 clients, with same result - mainly I use TortoiseCVS for that kind of work, but just for a test I downloaded a command line tool from http://subversion.tigris.org/.

Might it be a problem with my Internet access ? Hopefully not...

betajaen

20-06-2007 18:12:31

Try TortoiseSVN. It's what I use.

ebol

20-06-2007 18:46:46

Unfortunately, the same error...

Its not that I cant get the latest version at all, currently I download all the files with my download manager and recreate the directories structure... well, its doable, but quite annoying :?

daedar

20-06-2007 21:12:33

betajaen, do you have implemented the Continuous Detection Collision and collisions callbacks between bodies yet? if no, when do you plan to do it?

I'm asking the question because we'll soon have a first release of our game (Another Day of Chaos) and as we'd like to know if we can add it to our features list :wink:

Thx a lot.

Daedar

betajaen

20-06-2007 21:20:23

Technically it's for Shapes and no. There has been some talk of CCD in a thread lower down. Perhaps you can join in.

daedar

21-06-2007 00:12:18

it seems that you've broken something in the TerrainShape... I'm using a png image for my heightfield (not a RAW), it works perfectly with .24 but not with .27. It seems that the Y position or the maxHeight have changed, thus my physic heightfield is below the graphic one :cry:

EDIT: ok in fact heightScale has been divided by 2 in the .27 : mMaxHeight / (32768.0f * 2) in the .27 and mMaxHeight / 32768.0f in the .24...

betajaen

21-06-2007 09:55:12

Yep. Change it back. I've been working on RAW images and it's been driving me up the wall, you'll see if you ever try it. :?

Pottej

21-06-2007 15:52:03

I'm having trouble connecting to the svn server too :( Is it a server issue?

betajaen

21-06-2007 16:32:04

Shouldn't be. I just tested it and it works fine.

Pottej

21-06-2007 17:00:55

Ah yeah I can connect now, dunno what was happening before.

Also: keep up the good work betajaen!

alejandro

21-06-2007 21:26:25

how ,can i use the setPosition method of the character,

i am using like this

Personaje->setPosition(Ogre::Vector3(0,100,0));

but it dont work :evil:

i am using 0.9


it doesnt work , when is inside the hitReporters class, but , in the other part, it works .

dermont

23-06-2007 09:51:29

Compiling on linux with supplied Code::Blocks project files:

/home/dermont/OGRE/Physics/nxogre3/NxOgre/source/NxOgreScene.cpp:244: error: ‘mCharacters’ was not declared in this scope
:: === Build finished: 1 errors, 28 warnings ===


Not familiar with NxOgre but looking at the code shouldn't mCharacters in NxOgreScene be wrapped with ifdef/def (?) , e.g.


#if (NX_2_7_CHARACTER == 1)
//////////////////////////////
#ifdef NX_DEBUG
mCharacters.dumpToConsole();
#endif

mCharacters.destroyAllOwned();
#endif

betajaen

23-06-2007 10:19:45

Yep.

Dutchie

23-06-2007 10:41:18

can't compile it...


ogre version: 1.4.2 Eihort
PhysX sdk version: 2.7.0, also tried 2.6.4
NXogre version: 0.9-27(latest)

i get these errors:

1>..\source\NxOgreShapeWheel.cpp(248) : error C2039: 'contactPosition' : is not a member of 'NxWheelContactData'
1> c:\dev\physx\sdks\physics\include\NxWheelShape.h(31) : see declaration of 'NxWheelContactData'
1>NxOgreCloth.cpp
1>..\source\NxOgreCloth.cpp(189) : error C2039: 'fromFluidResponseCoefficient' : is not a member of 'NxClothDesc'
1> c:\dev\physx\sdks\physics\include\cloth/NxClothDesc.h(280) : see declaration of 'NxClothDesc'
1>..\source\NxOgreCloth.cpp(197) : error C2039: 'toFluidResponseCoefficient' : is not a member of 'NxClothDesc'
1> c:\dev\physx\sdks\physics\include\cloth/NxClothDesc.h(280) : see declaration of 'NxClothDesc'
1>..\source\NxOgreCloth.cpp(1235) : error C2660: 'NxCloth::getShapePointers' : function does not take 2 arguments
1>..\source\NxOgreCloth.cpp(1283) : error C2039: 'setFromFluidResponseCoefficient' : is not a member of 'NxCloth'
1> c:\dev\physx\sdks\physics\include\cloth/NxCloth.h(26) : see declaration of 'NxCloth'
1>..\source\NxOgreCloth.cpp(1289) : error C2039: 'getFromFluidResponseCoefficient' : is not a member of 'NxCloth'
1> c:\dev\physx\sdks\physics\include\cloth/NxCloth.h(26) : see declaration of 'NxCloth'
1>..\source\NxOgreCloth.cpp(1295) : error C2039: 'setToFluidResponseCoefficient' : is not a member of 'NxCloth'
1> c:\dev\physx\sdks\physics\include\cloth/NxCloth.h(26) : see declaration of 'NxCloth'
1>..\source\NxOgreCloth.cpp(1301) : error C2039: 'getToFluidResponseCoefficient' : is not a member of 'NxCloth'
1> c:\dev\physx\sdks\physics\include\cloth/NxCloth.h(26) : see declaration of 'NxCloth'
1>..\source\NxOgreCloth.cpp(1367) : error C2664: 'NxCloth::addForceAtPos' : cannot convert parameter 2 from 'NxReal' to 'const NxVec3 &'
1> Reason: cannot convert from 'NxReal' to 'const NxVec3'
1> Constructor for class 'NxVec3' is declared 'explicit'
1>NxOgreCharacterController.cpp
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : warning C4183: 'getNxControllerManager': missing return type; assumed to be a member function returning 'int'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2065: 'mControllerManager' : undeclared identifier
1>..\source\NxOgreCharacterController.cpp(79) : error C3861: 'NxCreateControllerManager': identifier not found
1>..\source\NxOgreCharacterController.cpp(93) : error C3861: 'NxReleaseControllerManager': identifier not found
1>NxOgreCharacter.cpp
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : warning C4183: 'getNxControllerManager': missing return type; assumed to be a member function returning 'int'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2065: 'mControllerManager' : undeclared identifier
1>..\source\NxOgreCharacter.cpp(65) : error C2039: 'mControllerManager' : is not a member of 'NxOgre::CharacterController'
1> C:\dev\NxOgre\include\NxOgreCharacterController.h(66) : see declaration of 'NxOgre::CharacterController'
1>..\source\NxOgreCharacter.cpp(65) : error C2227: left of '->createController' must point to class/struct/union/generic type
1>..\source\NxOgreCharacter.cpp(79) : error C2039: 'mControllerManager' : is not a member of 'NxOgre::CharacterController'
1> C:\dev\NxOgre\include\NxOgreCharacterController.h(66) : see declaration of 'NxOgre::CharacterController'
1>..\source\NxOgreCharacter.cpp(79) : error C2227: left of '->createController' must point to class/struct/union/generic type
1>..\source\NxOgreCharacter.cpp(98) : error C2039: 'mControllerManager' : is not a member of 'NxOgre::CharacterController'
1> C:\dev\NxOgre\include\NxOgreCharacterController.h(66) : see declaration of 'NxOgre::CharacterController'
1>..\source\NxOgreCharacter.cpp(98) : error C2227: left of '->releaseController' must point to class/struct/union/generic type
1>NxOgreScene.cpp
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : warning C4183: 'getNxControllerManager': missing return type; assumed to be a member function returning 'int'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2065: 'mControllerManager' : undeclared identifier
1>..\source\NxOgreScene.cpp(428) : error C2227: left of '->updateControllers' must point to class/struct/union/generic type
1> type is 'int *'
1>NxOgreWorld.cpp
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : warning C4183: 'getNxControllerManager': missing return type; assumed to be a member function returning 'int'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C2143: syntax error : missing ';' before '*'
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(104) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\dev\NxOgre\include\NxOgreCharacterController.h(80) : error C2065: 'mControllerManager' : undeclared identifier
1>NxOgreRemoteDebuggerConnection.cpp
1>..\source\NxOgreRemoteDebuggerConnection.cpp(51) : error C2039: 'disconnect' : is not a member of 'NxRemoteDebugger'



edit nevermid, problem solved. didn't update to vs2005 service pack 1 yet -_-

vinvin

23-06-2007 23:35:43

There still are troubles with the version 27 for linux compilation... Some old errors (contactPosition, include case sensitivity, a bad include), and some new (unprotected use of mCharacters and Cloths, defining NX_DISABLE_CLOTH). Patch follows.

===================================================================
--- source/NxOgreShapeWheel.cpp (revision 27)
+++ source/NxOgreShapeWheel.cpp (working copy)
@@ -245,12 +245,7 @@
NxReal stravel = mWheel->getSuspensionTravel(), radius = mWheel->getRadius();

//have ground contact?
- if( s && wcd.contactPosition <= (stravel + radius) ) {
- mPose.t = NxVec3( mPose.t.x, wcd.contactPoint.y + radius, mPose.t.z );
- }
- else {
mPose.t = NxVec3( mPose.t.x, mPose.t.y - stravel, mPose.t.z );
- }

NxMat33 rot, axisRot, rollRot;
rot.rotY( mWheel->getSteerAngle() );
Index: source/NxOgreScene.cpp
===================================================================
--- source/NxOgreScene.cpp (revision 27)
+++ source/NxOgreScene.cpp (working copy)
@@ -237,11 +237,13 @@
mJoints.destroyAllOwned();

//////////////////////////////
+ #ifdef NX_2_7_CHARACTER
#ifdef NX_DEBUG
mCharacters.dumpToConsole();
#endif

mCharacters.destroyAllOwned();
+ #endif

//////////////////////////////

Index: include/NxOgre.h
===================================================================
--- include/NxOgre.h (revision 27)
+++ include/NxOgre.h (working copy)
@@ -36,7 +36,7 @@
#include "NxOgreCharacterController.h"
#include "NxOgreCharacterHitReport.h"
#include "NxOgreCloth.h"
-#include "NxOgreClothRayCaster.h"
+#include "NxOgreClothRaycaster.h"
#include "NxOgreFluid.h"
#include "NxOgreFluidMesh.h"
#include "NxOgreJointSet1.h"
@@ -67,4 +67,4 @@
#include "NxOgreUserStream.h"
#include "NxOgreWorld.h"

-#endif
\ No newline at end of file
+#endif
Index: include/NxOgreFluidMesh.h
===================================================================
--- include/NxOgreFluidMesh.h (revision 27)
+++ include/NxOgreFluidMesh.h (working copy)
@@ -93,4 +93,5 @@
};// End of namespace

#endif
-#endif
\ No newline at end of file
+#endif
+
Index: include/NxOgrePrerequisites.h
===================================================================
--- include/NxOgrePrerequisites.h (revision 27)
+++ include/NxOgrePrerequisites.h (working copy)
@@ -137,7 +137,9 @@
typedef Container<NxString, Actor*> Actors;
typedef Container<unsigned int, Shape*> CollisionModel;
typedef Container<unsigned int, const ShapeDescription&> CollisionDescriptionModel;
+#if (NX_USE_CLOTH_API == 1)
typedef Container<NxString, Cloth*> Cloths;
+#endif
typedef Container<unsigned int, ErrorReporter*> ErrorReporterList;
typedef Container<NxString, Helper*> Helpers;
typedef Container<NxString, Joint*> Joints;
Index: include/NxOgreStable.h
===================================================================
--- include/NxOgreStable.h (revision 27)
+++ include/NxOgreStable.h (working copy)
@@ -71,6 +71,7 @@
#define NX_DISABLE_FLUIDS
#define NX_DISABLE_SOFTBODY
#define NX_DISK_COOKING
+ #define NX_DISABLE_CLOTH

// Temp.
#define NX_2_6_CHARACTER
@@ -108,12 +109,12 @@

#include <Nx.h>
#include <NxPhysics.h>
-#include <ControllerManager.h>

#ifdef NX_WIN32
+#include <ControllerManager.h>
#include <OgreMemoryMacros.h>
#endif

//////////////////////////////////////////////////////////////

-#endif
\ No newline at end of file
+#endif
Index: include/NxOgreShapeDescriptionTerrain.h
===================================================================
--- include/NxOgreShapeDescriptionTerrain.h (revision 27)
+++ include/NxOgreShapeDescriptionTerrain.h (working copy)
@@ -71,4 +71,5 @@

};

-#endif
\ No newline at end of file
+#endif
+

danharibo

26-06-2007 19:09:36

How can i create a Ball Joint? Setting the anchor to 0,0,0 Just doesn't make a joint!

Argh :?

alejandro

26-06-2007 22:49:15

i have a revolute joint . when i add force to move, its swing for ever, and never stops

how can I stop naturally? or , make the joint stop by itself . reducing the velocity ?

betajaen

26-06-2007 23:07:35

Adjust the damping of the joint or the actor.

alejandro

27-06-2007 01:31:12

yes , thanks,

now , how can i make the swing with gets more velocity when the joint is decending ? like a a human in a swing

alejandro

28-06-2007 16:18:39

I need to make a thing , but i really dont know the word in english
in spanish is "bejuco or liana " maybe rattan , i dont know , but here some explication : the branches in which tarzan used to hang .

i need to do , like a a pulley joint , i have think that maybe with the cloth , can work , but i dont know , how to stick the extreme of the cloth , to something.


what i want to do is , a monkey , that simulate when tarzan swing .

alejandro

28-06-2007 17:04:28

thanks for all. my anwers is in the

Lesson 1005 - Attachment

i will do .

Aiursrage2k

01-07-2007 03:19:41

My program kept on crashing, it seemed to happen whenever I tried to move my character.

I traced it to the BaseCharacterHitReport::onActor function. The problem and solution is easy to fix, check that the actor parameter is not null. I am not sure why its passing a null actor, all I am doing is creating a character and a static box to stand on.

betajaen

01-07-2007 11:14:40

If the actor is NULL then it's an NxActor that wasn't created by NxOgre.

betajaen

02-07-2007 14:35:28

Groups!



ActorGroups

First up is ActorGroups, which basically separate Actors into well Groups. The best bit about Groups is you can execute bits of code when a Actor of one Group is in contact with another.

So here we go:

mKnifeGroup = mScene->createActorGroup("Knife");
mButterKnifeGroup = mScene->createActorGroup("ButterKnife");


NxOgre automatically assigns a PhysX Group ID to both of those groups for you, and will reuse any old ID's from deleted Groups. Although you can have up to 32767 possible ActorGroups it's a pretty good idea.

Now to assign an ActorGroup to a Actor we do it through the ActorParams.

mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1),Vector3(0,0.5f,0),"Mass: 100, Group: Knife");


Obviously, to setup a callback we'd need two Groups here. But I'm going to skip ahead and show how they work.

First is the traditional inherited class method:

class myCallback : public GroupCallback::InheritedCallback {

public:

void onStartTouch(Actor*, Actor*) {

}

void onEndTouch(Actor*, Actor*) {

}

void onTouch(Actor*, Actor*) {

}

};


mKnifeGroup->setCallback(mCallback);
mKnifeGroup->setCollisionCallback(mButterKnifeGroup, NX_NOTIFY_ALL, true);


The second and my favorite method is using Class->Method Pointers, and demonstrated in the picture above:

class myCallback {

public:

void TurnRed(Actor* a , Actor* b) {
Body* bd = static_cast<Body*>(b);
bd->getEntity()->setMaterialName("nx.capsule");
}

void TurnYellow(Actor* a, Actor* b) {
Body* bd = static_cast<Body*>(b);
bd->getEntity()->setMaterialName("nx.cube");
}

void Jiggle(Actor* a, Actor* b) {
b->addForce(Vector3(NxMath::rand(-10,10), NxMath::rand(-10,10), NxMath::rand(-10,10)) * b->getMass());
}
};


mKnifeGroup->setCallback<myCallback>(mCallback, &myCallback::TurnRed, &myCallback::TurnYellow, &myCallback::Jiggle);
mKnifeGroup->setCollisionCallback(mButterKnifeGroup, NX_NOTIFY_ALL, true);



ShapeGroups

Next up is ShapeGroups, which basically control if shapes of an Actor can collide with each other. There can only be up to 31 of these, so obviously NxOgre controls the GroupID's for you and reuses any old ones.

mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1, "Group: Fork" ),Vector3(0,0.5f+i,0),"Mass: 100");

mForkGroup->setCollisionResponse(mSpoonGroup, ShapeGroup::CR_No_Collision);


These features will be available in...


...The next version '28. Amongst with quite a few nice stuff, including 16-bit heightfields.

daedar

02-07-2007 17:49:03

Yes! very nice!!!

I will finally have my vehicle collisions :D

Thanks!

betajaen

03-07-2007 23:52:27

Triggers!

Triggers are back in. Unlike the 0.6 Triggers, the 0.9 Triggers use the Actor class as a base. So not only you can (theoretically) do the same things with Triggers as Actors, but use every shape available (except for WheelShape) as a TriggerShape. They also use the same type of callback system for ActorGroups, so everything will be very familiar to some people.

Here we go:

mTrigger = mScene->createTrigger("testTrigger", new CubeShape(10,10,10), Vector3(0,5,0), "static: yes");

mTrigger->setCallback<myCallback>(mCallback, &myCallback::TurnRed, &myCallback::TurnYellow, &myCallback::Jiggle);



When are you gonna release it betajaen!!?

Since 2.7.2 was released yesterday. I'm planning to release '28 within days (perhaps tommorow). This will be the last NxOgre supporting 2.7.0 and '29 onwards will be supporting 2.7.2+. The first thing I'll be working on is wrapping (and perhaps improving upon) the amazing ForceField feature!

betajaen

04-07-2007 09:55:13

NxOgre 0.9-28

0.9-28
- TerrainShape constructors rewritten and working.
- Raw Heightfield completely fixed and working.
- Image size and depth for Raw heightfield's are automatically worked out by the filesize.
- Bug with Empty Params set.
- MeshShape renamed to TriangleMeshShape, set NX_USE_LEGACY_TERMS to 1 to use MeshShape instead.
- ActorGroups implemented
- Callbacks (Inherited Classes and Method Pointer) implemented
- ShapeGroups implemented
- Triggers implemented
- TriggerCallbacks (Inherited Classes and Method Pointer) implemented.

<Betajaen> 02-July-2007

- Worked on Raw Heightfield and scaling bugs
<HexiDave> 28-June-2007


Note: This is the last NxOgre which will work with 2.7.0. The next NxOgre commit will contain features that are only available in 2.7.2 onwards.

daedar

04-07-2007 11:25:39

Great ! Thx betajaen :D

For the TerrainShape, what about the *old* first param? (size of the terrain)
and the nbRows? (if we want a low detailed shape) I guess we can just change the image resolution but it was helpfull to change the terrain shape detail on the fly depending on the configuration of the user...

Thx

betajaen

04-07-2007 11:27:44

Nope sadly not, you should just reduce the texture size. I'll be adding a feature to scale the terrain in the future though.

daedar

04-07-2007 11:32:21

Ok... to scale the terrain, it seems that I only have to change rowScale and columnScale?

betajaen

04-07-2007 11:41:50

If you modify NxOgre sure. At the moment it's not possible with the current three arguments of the TerrainShape constructor.

betajaen

04-07-2007 17:29:05

ForceFields




I had an idea similar to ForceFields a month back. I was going to call it the Force Class, which used an intersection to apply a specific force to Actors within a certain range.

Seems Ageia beat me to it, and made the idea 1000x times better. That there is a ForceField. It's using the demo code that comes with the samples, but directly put into NxOgre.

There are 2048 Cubes in there. Thats 2048 NxOgre Body Classes, with 2048 Entities, and 2048 SceneNodes. Running in release I'm getting 24FPS.

Although all of the ForceField code is hardcoded at the moment, the above screenshot was just created by these lines:

mScene->createForceField("FF", Vector3(0,0,0), "spoon: yes");
for (int i=0;i < 2048;i++) {
mScene->createBody("cube.1m.mesh", new CubeShape(0.1),Vector3(1,0.1f + (float(i) * 0.1f),0),"Mass: 1, node-scale: 0.1 0.1 0.1");
}



I think an applause is in order for Ageia for creating this new feature and seriously understating how amazing it is.

Caphalor

04-07-2007 18:01:45

Hm to be honest, I don't understand the sense of ForceFields at the moment. Could I use them for example for Explosions? :D

And a Video would be nice. ;)

betajaen

04-07-2007 18:13:54

Yep. Explosions are pretty easy, and on any scale from a grenade to nuclear. You can also do Wind to move tumbleweed around or for it to ripple through sheets of cloth and other large scale effects.

I tweaked the code slighty and we have a better tornado effect. Shown in this 5 MB video (playable in VLC) here.

Caphalor

04-07-2007 21:00:48

Wow this really seems to be a really cool and useful feature. Applause for ageia and Betajen! :)

frier

05-07-2007 02:52:09

Hi guys,

Ive just started with NxOgre and I'm taking baby steps!. Whats the quickest way i can pick up NxOgre. What do i have to read? theres alot of syntax around that doesn't fit in with 0.9, since its meant for 0.4,unless i'm mistaken. Any advice?

All i want to do now is get a character to collide with terrain and make the character stay on the terrain.

Aiursrage2k

05-07-2007 04:01:58

Hi guys,

Ive just started with NxOgre and I'm taking baby steps!. Whats the quickest way i can pick up NxOgre. What do i have to read? theres alot of syntax around that doesn't fit in with 0.9, since its meant for 0.4,unless i'm mistaken. Any advice?

All i want to do now is get a character to collide with terrain and make the character stay on the terrain.


First off a quote from the first post

There are no tutorials or documentation, the entire code is purely given from the NxOgre subversion server. It is not designed for newbie use, it currently does not have the same features of 0.6.

DO NOT USE THIS LIBRARY, IF YOU HAVE NO PRIOR EXPERIENCE WITH NXOGRE


Create a test bed, implementing all/some of the demos, this should help you understand whats going on. It should then be straightforward to update to version 9

Also look at the conversion from 6 to 9
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=4350
###
You implemented the force field really quick!

betajaen

05-07-2007 09:56:01

When 0.9 gets a bit more closer to 1.0 in terms of features. I'll release my Sandbox code or at least a variation of it.

You implemented the force field really quick!

I cheated. It's all hard coded. I have a some good ideas on how to implement it though. Such as a helper ForceFieldFormula class, which would be passed into the ForceFieldParams class, Which is read and used by the ForceField class.

I was thinking last night that. A really good tornado effect could be made with Ogre's Particle system and this - Using a concept of "FXScence's" used in 0.6, a dummy tornado in a separate scene with thousands of NxActors acting as point particles which control billboards with dust textures.

I can just imagine fake cow's being lifted up, and destructible houses be ripped apart right now. ;)

ANdys

05-07-2007 14:03:06

I happened a crash when Character hit Terrain.
It can't get the "Actor* a" data.

CharacterHitReport::Response BaseCharacterHitReport::onActor(Character*, Actor* a, Shape*, ActorGroup*, const NxControllerShapeHit& h) {

if (!a->isDynamic()) //<======================================= crash
return RS_Push;

NxReal coeff = a->getMass() * h.length * 10.0f;
a->getNxActor()->addForceAtLocalPos(h.dir * coeff, NxVec3(0,0,0), NX_IMPULSE);

return RS_Push;
}


Same code whitout Character.Useing Remote Debugger,It also crash.But it crash on different way. I use 3000*3000 PNG to create the Terrain.
Before useing 0.9.28, I use 513*513 PNG to create the same size of Terrain. So,I had try to use the old PNG in 0.9.28, and it can work with Remote Debugger.

Any ideas? :)
Thanks!!

betajaen

05-07-2007 14:25:14

A is null for some reason. For a quick fix add this code just before that if block.

if (a==0)
return;


I'll investigate later why it crashes later, but when I was working on Terrain, the tutorial code I was working had a character upon the terrain.

[Edit] I have the same bug too.

betajaen

05-07-2007 15:05:16

Okay, got a Fix. It was to do with the UserData. Which was a NxActorUserData (which now it's suppose to be), and it was casted into an Actor. Which causes the crash.

In "NxOgreCharacterController.cpp", add the line to the include lines

#include "NxOgreUserData.h"

In the same file, change the line 159/160 to:

Actor* actor = (static_cast<NxActorUserData*>(hit.shape->getActor().userData))->toActor();

It should work then.

ANdys

05-07-2007 15:10:15

Very Thank You!!~

and a question.
Does Character will be update some function like jump in the future?

betajaen

05-07-2007 15:14:12

Hopefully. Jumping is on my list somewhere.

I'm working on ForceFields this week, and I want to implement Dominance groups as well. So I'll get there eventually. Unless someone else gets there before I do. :wink:

ANdys

05-07-2007 16:37:39

ForceFields is amazing that you did!!
so,Did you try to use the Particle with that ?
I'm so interest about the two interaction. :P

betajaen

05-07-2007 16:48:22

Nope. No Particles or Billboards. It's all tiny cube shaped Actors.

I'm sure if Billboards or some Shader effect was used, the average FPS would increase.

betajaen

05-07-2007 17:56:03

Another ForceField video!



This video has a mixture of everything; Cubes, Mini-Cubes, Spheres and Cloth, in a massive tornado. Around 1100 of Actors and Eight Cloths.

The Video is 18 Megs, so to save my bandwidth. Save to Disk and not Open with please. If you want a repeated viewing. ;)

Video

Caphalor

08-07-2007 15:02:00

In 0.4, I used a "customStateMachine" to handle collision reporting. I used body::addState and Scene::CreateStateContactPair. Could you give me a short example how to handle collision reporting in 0.9?

betajaen

08-07-2007 15:18:55

The State system hasn't been designed or written for 0.9 yet, so you'll have to use [b]Actor Groups[/b] instead.

<~Creatine~>

08-07-2007 19:57:34

I tried CCD but the rocket can move across another things with high speed.

rocket[rockets] = aScene->createBody("rocket.mesh", newConvexShape("rocket_bbox.mesh", "ccd: yes"), rocket_pos, "mass: 1");

What did I forgot?

betajaen

08-07-2007 20:10:59

It's not implemented, yet.

Caphalor

08-07-2007 21:46:06

Thank you for the help, but I have another question. I can't find Meshshapes. :(
Aren't they implemented yet? I need them for my static Levelmesh. (I don't want to use terrain)

Edit: Oh I see that there are "TriangleMeshShapes". Please delete this post. :D

Edit2: To slow.

betajaen

08-07-2007 21:48:16

Yes, but they are called TriangleMeshShape now.

asafdav2

09-07-2007 06:53:55

being a lazy NxOgre noob, i was reading the 'DO NOT USE THIS LIBRARY, IF YOU HAVE NO PRIOR EXPERIENCE WITH NXOGRE' warning in the first post, and i'd like to ask if you believe i still better off start with 0.6 (i'd rather avoid relearning stuff - after all, it's been two months since this post and i believe 0.9 has matured during this time).

betajaen

09-07-2007 09:11:57

I agree. NxOgre 0.9 is just as good as 0.6, apart from the bug here and there. For Subversion it's pretty stable.

<~Creatine~>

09-07-2007 09:47:09

When will be Forcefield on SVN? Can it central explosions with different forces and rotations (it looks like an air pressure)?

betajaen

09-07-2007 10:16:59

Yes, when it's done.

alejandro

09-07-2007 14:35:53

i have a strange problem , i have updated to the new version of nxogre, and when add this line the system crash. but , not in the creation , of the body , after. :cry:

m_terreno =m_Escena->createBody("terreno.mesh", new NxOgre::TriangleMeshShape("terreno.mesh"), NxOgre::Pose(Ogre::Vector3(0,0,0)), "static: yes");

betajaen

09-07-2007 14:41:30

It works for me. Try cube.1m.mesh, if that works then your mesh probably has duplicated vertices.

Caphalor

09-07-2007 15:25:15

Ok, everything compiles now. I have a character and a static mesh, but in the moment they collide, it crashes.
Code to setup levelmesh:
Testdungeon = mScene->createBody(
"Testdungeon2.mesh",
new NxOgre::TriangleMeshShape(
"Testdungeon2.mesh",
"mesh-scale:0.2 0.2 0.2"),
Vector3(0,baseY + 5,2),
"node-scale:0.2 0.2 0.2, static: yes"
);


Code to setup character controller:

mCharacter = mScene->createCharacter(Name, Position, "type: box, dimensions: 1 2 1");
mCharacter->attachMesh("cube.1m.mesh");
mCharacter->getNode()->scale(1,2,1);
mCharacter->getNode()->attachObject(mCamera);
mCamera->setPosition(0,1.8,0);


I see the the character controller, I see the mesh - but when they collide... :(
At the moment, I'm not using any collision callback. The last message in the NxOgre log ist "Scene Character registered".

Edit: When I create a "FakeFloor" using mScene->createActor("FakeFloor", new CubeShape(100,2.1f,100), Vector3(0,-0.05f,0), "static: yes"); , I have the same problem.

alejandro

09-07-2007 15:35:36

look , the new code has a error in the character controller "Which causes the crash" , and you cant know from your code,

yep , finaly i understand , after search for errors in my code .

WHEN THE CHARACTER CONTROLLER COLLIDE , ALWAYS CALL THE onShapeHit FUNCTION , and its has the error

just change the line 159/160 to:
Actor* actor = (static_cast<NxActorUserData*>(hit.shape->getActor().userData))->toActor();

and evething works fine !! :D

Caphalor

09-07-2007 15:47:01

Thank your for the fast answer, but


NxControllerAction CharacterController::onShapeHit(const NxControllerShapeHit &hit) {
CharacterHitReport::Response response = CharacterHitReport::RS_None;
Character* character = static_cast<Character*>(hit.controller->getUserData());
Actor* actor = static_cast<Actor*>(hit.shape->getActor().userData); //I tried to replace this with your code, but is causes an error
ActorGroup* group = 0;//actor->getGroup();
Shape* shape = static_cast<Shape*>(hit.shape->userData);

// Go through any existing reporters.
for(CharacterHitReports::Iterator it = mHitReports.items.begin();it != mHitReports.items.end();++it) { //THAT'S LINE 159

CharacterHitReport::Response r = (*it)->onActor(character, actor, shape, group, hit);

if (r != CharacterHitReport::RS_None) {
return (NxControllerAction) r;
}

}

// Fire up the final base reporter.
return (NxControllerAction) mBaseHitReport->onActor(character, actor, shape, group, hit);

}



EDIT: It works. I only had to include NxOgreUserData.h. :D
But it's line 155. ;)

alejandro

09-07-2007 19:07:42

hi, can i make the trigger non static, and move with my character?

Caphalor

09-07-2007 22:29:51

I almost finished porting and everything seems to work! I love NxOgre and PhysX (Video)
Really great work, I like the new parameter system, I like the new syntax style, I like everything. :D

betajaen

09-07-2007 22:45:02

I'm glad you like it, and good video. It's nice to see NxOgre working outside the sandbox grid system.

danharibo

12-07-2007 19:21:17

looks awesome, But i'm still confused about creating Ball Joints? Revolute joints only turn on one axis, i need all three!

betajaen

12-07-2007 20:16:11

There called SphericalJoints.

betajaen

12-07-2007 22:32:01

Serialisation!

It's in and it's working, and it only takes ONE line to save an entire scene to a single file.

mWorld->getSerialiser()->saveScene(mScene, "test.dae");

And to restore it.

mWorld->getSerialiser()->restoreScene(mSceneMgr, "test.dae");

What's better, that the Serialiser supports THREE formats; COLLADA, XML and Binary.

Of course there are lots of things to be done. Only Scenes, Actors (with and without entities), Shapes, Groups and Materials are exported. But it should be pretty easy to expand it to the other parts of NxOgre.

I'll would also like to support it to save to memory or to a stream, so people can handle the file stuff themselves or attach additional data.

asafdav2

13-07-2007 11:11:28

any reason you write it as Serialisation and not Serialization?

BloodyFanatic

13-07-2007 11:29:15

he's british :)

betajaen

13-07-2007 11:29:20

I speak English, Serialisation is the correct spelling over here.

ebol

13-07-2007 13:29:09


Serialisation!

It's in and it's working, and it only takes ONE line to save an entire scene to a single file.


And its another great feature in NxOgre :) Thanks betajaen.

Just one question, since I can't test this at this moment. I assume, that only scenes that were previously saved from NxOgre can be later restored ? Or can we load a ,lets say, xml file created for ex. via PhysX 3ds max plugin (and only things currently supported by NxOgre will be loaded) ?

betajaen

13-07-2007 13:50:00

I believe you can. There are some snags though.

The COLLADA format used by PhysX does not support userProperties. So there is no way to tell what mesh goes with which actor, and any special things such as node heirarchy and pose. This is more to a limitation of NxuStream2 than NxOgre. It also doesn't take advantage of the format to include mesh information which could be loaded by Ogre.

However, the Native PhysX XML format works very well with NxOgre. Exporting and Importing within NxOgre works flawlessly. Exporting from an external application does require you to add things into the userProperties (Information such as: Is it an Actor or a Body, If it's a body what mesh is to be used. Additional Nodes. States, etc.).

I believe you can convert between formats as well, meaning that the 3DS Max plugin would work with NxOgre. Assuming you don't mind converting the file formats, and opening a text editor and doing a bit of hand editing* to specify Ogre meshes for each actor.

For the purposes of fun; here is a sample scene with a forcefield and 5 Bodies dancing in it.

http://www.nxogre.org/screens/sample.xml


* I would prefer some application to do this for you or at least some place in the 3Ds Max editor to insert it into the file for you. Without having 3Ds Max, I will never know.

joi

13-07-2007 16:49:04

AHA. You ended up using COLLADA after all. :twisted:

Thank you for that! ;)

betajaen

13-07-2007 16:53:20

Well Collada is one of the export options. I still prefer the XML and Binary file formats though.

jchmack

13-07-2007 17:59:23

Hopefully. Jumping is on my list somewhere.


lol i swear i had written the jumping part already SOMEWHERE... I remember just copy pasting the code from the old 0.6 lib. But i upgraded to a newer version and now i cant find it...... Bah i was gonna post it and be all proud lol.

alejandro

14-07-2007 00:43:24

I thinks it would be better if we can move the character passing the evt.timesinceLastFrame , and add.

void Character::addMovement(Direction m,const Ogre::FrameEvent& evt)

mNextMovementDirection += NxVec3Axis[NX_X]* velocidad * evt.timeSinceLastFrame;

because , it could move with the same velocity in all pc . i think
or are you passing in other place ? betajaen

betajaen

14-07-2007 00:47:15

And that's why I've provided the class "CharacterMovementVectorController" to deal with such things for you.

jchmack

15-07-2007 20:18:28

I thinks it would be better if we can move the character passing the evt.timesinceLastFrame ,

because , it could move with the same velocity in all pc . i think
or are you passing in other place ? betajaen


Actually I've tested it on different computers and it does move the same in the latest versions. But i did have that issue on the older versions. I don't know the problem on those but i believe its fixed in the later ones.

<~Creatine~>

18-07-2007 15:00:08

I tested the force field spherical shape in 2.7.2 and I made explosion. It is really cool effect. 8)
I can't wait for SVN forcefield class. :D http://www.gamebuilderz.extra.hu/download/forcfield.wmv

danharibo

20-07-2007 16:42:23

hmm
i have a 15000 weight tractor, and a 8000 mass trailer, i make a joint and the tractor starts to do a wheelie! What? how can i fix it!

betajaen

20-07-2007 17:30:32

Lower the center of the mass of the tractor and trailer.

danharibo

20-07-2007 17:45:54

Lower the center of the mass of the tractor and trailer.I fixed it, the x/y/z of NXVector is different to Ogre's, the joint was 3 feet above the tractor

frier

25-07-2007 06:11:25

Can someone tell me what cakes used for? and what it does? :(

betajaen

26-07-2007 14:57:02

Cake is a sandbox type application written by me for NxOgre. Thread is one down.

betajaen

26-07-2007 15:20:49

NxJSON

"JSON" is a data format, it's quite common in the JavaScript circles but is slowly spreading to other areas, and now in NxOgre.

{
"Birthday Presents" : {
"Danhairbo" : "A box of Haribo sweets",
"Jacmoe" : "A signed photograph of Moe Szyslak",
"Luis" : "Babysitter",
"Sinbad" : "A new ship"
}
}


The problem with the current situation of the NxuStream tool that Ageia wrote however glorious and handy it is, the file formats used can't be used with NxOgre or any wrappers that use their own custom data. Well they can, either using the "UserProperties" flag which you have to cram in or hack, or go your own route and attach an additional file with the data. The worse thing is, only Binary and XML support it. Our beloved COLLADA doesn't!

So along with COLLADA, Binary and XML. I've added JSON to NxuStream to work fully with NxOgre. It's intended use is for exporting and importing within an NxOgre application, and less for Scene Exporters,etc. That's XML and COLLADA's job which you can convert to JSON pretty easily if you wanted to.

As I'm using JSON-CPP as an dependency, NxJSON is now an optional part of NxOgre and can be just used or not used by flicking a compiler flag.

Since I've been working on this yesterday I've got some of the World exported and no importing yet. But here are two exported files from the same Scene and at the same time. Once I've completed NxJson, I'll start on a Binary "Save Game" style suitable format.

[b]JSON[/b] and [b]XML[/b].

And the best thing. All of this wonderful stuff is arriving tomorrow.

NickM

26-07-2007 16:26:44

Sounds great betajaen, thanks :D