[Bleeding] PhysX Character Controller + NxOgre

almondega

03-02-2009 23:45:40

Hi, i'm trying to use the Character Controller from PhysX within NxOgre and i have some questions

1: there are some source about this CCT + NxOgre where can i look at to get a start?
2: NxCharacter from PhysX has the public source code, should i use it, using some PhysX functions, or try to convert all to the NxOgre functions?

tks :wink:

almondega

04-02-2009 22:15:07

after some trial and error..
i almost got the character controller working..

here is the preview: http://www.youtube.com/watch?v=KWLhWR9uv0o

the problem is: there's no collision detection with the enviroment, witch causes the actor goes foward forever...
any clue how to solve this?

this character was created using the Physx code + NxOgre scene
i can post the code if needed
tks :wink:

nargil

05-02-2009 00:07:49

Post the code ! Even if I can't help (will try anyway, though) I still want to see it ;)

betajaen

05-02-2009 00:14:36

You need to use the callback so it knows to auto-step or not move. The callback should also have the code to push any dynamic actor that you wish out of the way.

almondega

05-02-2009 04:04:41

betajaen: i'm using a callback (from physx), the problem is, it isnt working (maybe is not compatible with the nxogre callbacks or scene configuration)

also, it's very hard to port the physx code and i have no ideas how to mix the physx character callback within nxogre callbacks

attached is the code, it is a big mess!!!
so, be patient to read

the main points in the code are:
- class ControllerHitReport (this one dont work so far, this is the main callback to get cct working)
- class CharacterManager constructor: creates and allocates a Capsule character
- class CharacterManager update(): move the character controler foward in: cm_controller->move

:o

how to use:

#include "CharacterManager.h"

// in some creation method:
// mWorld = NxOgre world
// scene = the current scene from mWorld
CharacterManager *cm = new CharacterManager(mWorld->getPhysXDriver()->getSDK(),scene->getNxScene());

// in some render loop or frameStarted
cm->update(evt.timeSinceLastFrame);

betajaen

05-02-2009 08:49:35

I rewrote the PhysX Character Code into Bloody Mess, if you want to have a look at that I can post a copy. Things will obviously be different but you may pick up from where you went wrong.

almondega

05-02-2009 16:55:09

that would be great !
based on a NxOgre code should be easier than physx code

tks betajaen, where can i get it?

betajaen

05-02-2009 20:22:02

Attached is the KinematicController.cpp and KinematicController.h files. It's a mix between PhysX and NxOgre classes, and it's based on Bloody Mess which is really different from Bleeding.

Either way, it's a start.

almondega

05-02-2009 20:39:44

tks a lot !
i'll try it
:wink:

almondega

07-02-2009 23:01:24

well.. i started to convert the 1.5.2 Character Controller to the bleeding version

i saw in the code a lot of DoubleReal3 for vector
but i changed all to the ogre vector, Vector3, witch uses Real as values

then, i'm getting vector overflow after the "sweep" operation
this is because i'm using Real instead DoubleReal?

tks :wink:

Brixican

08-02-2009 05:46:06

Hey Almondega,

I Like your work so far! I'm glad somebody is working on the character system in Bleeding, I have been studying the character system in the PhysX sample folders, as well as Kinematic Controller in Bloody Mess, but I still have no idea how to port it to bleeding. I'm sure many (including myself) would love to see your progress! Keep us updated!!

Brixican-

betajaen

08-02-2009 12:22:37

well.. i started to convert the 1.5.2 Character Controller to the bleeding version

i saw in the code a lot of DoubleReal3 for vector
but i changed all to the ogre vector, Vector3, witch uses Real as values

then, i'm getting vector overflow after the "sweep" operation
this is because i'm using Real instead DoubleReal?


You shouldn't. But DoubleReal3 is a struct of three doubles (not floats), so I would work with that.

I can attach the DoubleReal3 classes, and SimpleShapes classes if you want.

almondega

08-02-2009 17:46:37

i downloaded the Mess version, witch has the doublereal3 class
if that is the updated version, so dont need to post here =]
i'll convert again to the doublereal3 and post here if the overflow is fixed
tks :wink:

almondega

11-02-2009 06:01:51

well, a new programmer come into my project, and a friend of him did some wrappers for physx, witch includes a character controller using ogre

i already got it working, and i'll ask him if i can post the controller code here
anyway, i'm posting my "not" working conversion i did for bleeding using the mess version
the current bug you can read in the post before this one (also has a remark on the cpp code), and try to fix it

note: this conversion is based on the: NxOgreKinematicController.h and cpp from Mess version