[CharacterController] CharacterController Addon Thread

betajaen

05-12-2009 18:09:03

This is an addon to wrap the NxCharacter.dll into the NxOgre namespace written in the same style as NxOgre and using it functions. It does not incoportate the actual source, so you will still need to have the NxCharacter.dll in your directory.

The addon only wraps the NxCharacter.dll, and does not (apart from one feature) any extra bits or handy shortcuts you get with NxOgre. However; it does use the same function names and class names, so most of the tutorials in PhysX for the Character Controller will work.

To use

Just include "NxOgreAddonCharacterController.h" with "NxOgre.h" in your code. You will need to link to NxOgreAddonCharacterController.lib. Both header and libraries are in the SDK directory, so you won't need to add anything to your paths. You need to compile the NxOgreAddonCharacterController, it is in the normal NxOgre solution.

Next you need to make the ControllerManager, it's a world level class.

mControllerManager = new NxOgre::ControllerManager();

Then delete it when it is appropriate.

delete mControllerManager;

To make a character

A character needs two things to be created, a CharacterDescription (like Scenes, RigidBody) and a PointRenderable which your Rendersystem will create. I'm going to use Ogre here for this example, but in OpenGL it would be similar.

ControllerDescription desc;
desc.mPosition.set(0,3,0);
desc.mCallback = this;

mControllerRenderable = mRenderSystem->createPointRenderable("cube.1m.mesh");

mController = gControllerManager->createBoxController(desc, Vec3(1,1,1), mScene, mControllerRenderable );


You don't need to use a PointRenderable, but it will be invisible like Actors. In that case you may want to use your own system for Rendering - which is fine.

Move

You move via the move function;
mController->move(movingVector, COLLIDABLE_MASK, 0.01f, collisionFlags);

Setting the orientation

This is an extra feature added for convenience. The setVisualYaw and getVisualYaw functions use a Radian to "turn" the PointRenderable. It does not effect anything to move, it is purely visual. However you may want to use the visualYaw to keep a note down of where your character is facing, and incorporate that into your moving vector.

mController->setVisualYaw(0.707f)

betajaen

10-01-2010 17:59:38

The latest BloodyMess has the CC code as an addon. Keep all of your posts about the CC addon in here only. I literally cannot remember if it works or not.

But thank Spacegaier for bugging me to publish it. ;)

tertle

10-01-2010 23:15:13

Seems to load fine, I just had to setup a ControllerCallback which wasn't mentioned.

Thanks for the release

-edit-

I can't seem to get the move working. Position, rotation etc all work but it just won't move.

Anyone had any luck?

tertle

16-01-2010 11:41:51

I'm an idiot, I should have checked this in the first place (though I haven't really spent much time on it.)

The move works fine, just the visual element doesn't stay attached to the controller after a move. It does after a position though so I'm not sure, guess I'll look at it tomorrow.

getPosition seems to be returning the value before a move, rather than an updated one. Or more that move somehow doesn't seem to update it's position which makes no sense...

ahtm80

16-01-2010 16:19:29

hi, i dont work character controller.
Give error COLLIDABLE_MASK and collisionFlags. Also triangle (*.nxs) to defined object not collision(pass through). Please helpme. Waiting for answers.
Thanks.

tertle

17-01-2010 00:10:51

Found a fix to making move work.

You need to update the controllers before rendering

Don't know how to submit it, but if anyone wants to use the move function, just change it to this

NxOgreAddonCharacterControllerController.cpp
void Controller::move(const Vec3& displacement, unsigned int activeGroups, float minDistance, unsigned int& collisionFlags, Real sharpness)
{
mController->move(displacement.as<NxVec3>(), activeGroups, minDistance, collisionFlags, sharpness);
mManager->updateControllers();
updateRenderable();
}


there is probably a better place to update controllers especially if something else doesn't work but it's a temp fix (could always shove it at start of updateRenderable).

ahtm80

17-01-2010 19:10:54

Dont work character control. COLLIDABLE_MASK and collisionFlags what is not clear. callback = this dont work. trianle collision(*.nxs folder) dont work.

tertle

17-01-2010 22:29:10

sigh no need to spam but I'll reply anyway.

desc.mCallback = this; won't work unless your class inherits from ControllerCallback

you can to begin with while getting it all compile just set it to NULL to use default callback.

otherwise either make your own class as a callback and inherit

class ControllerHitReport : public NxOgre::ControllerCallback
{
public:
NxOgre::Enums::ControllerAction onShapeHit(const NxOgre::ControllerShapeHit& hit)
{
return NxOgre::Enums::ControllerAction_None;
}

NxOgre::Enums::ControllerAction onController(NxOgre::Controller* controller, NxOgre::Controller* other)
{
return NxOgre::Enums::ControllerAction_None;
}
};


Hitreport hitReport;
desc.mCallback = &hitReport;


or just inherit in your current class

class PlayerController : public NxOgre::ControllerCallback
...
//override functions
...
desc.mCallback = this;


I have no idea what you've done to screw with your with your .nxs model file, but my move just currently looks like this anyway.

enum GameGroup
{
GROUP_NON_COLLIDABLE,
GROUP_COLLIDABLE_NON_PUSHABLE,
GROUP_COLLIDABLE_PUSHABLE,
};

#define COLLIDABLE_MASK (1 << GROUP_COLLIDABLE_NON_PUSHABLE) | (1 << GROUP_COLLIDABLE_PUSHABLE)

...

unsigned int collisionFlags;
mController->move(dir,COLLIDABLE_MASK,0.000001f,COLLIDABLE_MASK,1.0f);

ahtm80

19-01-2010 19:23:15

Thanks tertle,
Character controller run until stable, i will not use.

tertle

21-01-2010 23:23:19

Can anyone get controller callback to work? I'm having trouble. There is nothing really inside it at the moment, but it doesn't run anyway.

My current callback

class MyControllerHitReport : public NxOgre::ControllerCallback
{
public:

NxOgre::Enums::ControllerAction onShapeHit(const NxOgre::ControllerShapeHit& hit)
{
if(hit.mShape)
{
NxOgre::GroupIdentifier group = hit.mShape->getGroup();
if(group==GROUP_COLLIDABLE_PUSHABLE)
{
//NxActor& actor = hit.mActor;
//if(actor.isDynamic())
//{
if(hit.mDirection.y==0.0f)
{
float coeff = hit.mLength * 10.0f;
//float coeff = actor.getMass() * hit.mLength * 10.0f;
//actor.addForceAtLocalPos(hit.mDirection*coeff, NxVec3(0,0,0), 1);
}
//}
}
}

return NxOgre::Enums::ControllerAction_None;
}

NxOgre::Enums::ControllerAction onController(NxOgre::Controller* controller, NxOgre::Controller* other)
{
return NxOgre::Enums::ControllerAction_None;
}

};


MyControllerHitReport mReport;
...
desc.mCallback = &mReport;


and

mManager->updateControllers();

is run after every move if that's relevant.

am I missing something in the setup of this? thanks.

ndoxx

02-02-2010 11:09:05

Hi,

I am currently implementing character controller using NxOgre addon, i have questions on how to use it:
1. I can create capsulecharactercontroller, but when i check it in RemoteDebugger, it is not affected by gravity
2. I manually create my character mesh in ogre, because i implement callback on ogre background resource loader. How could i associate my ogre entity with my capsulecharactercontroller?

Thanks,
Ndoxx

tertle

03-02-2010 03:49:08

1. I can create capsulecharactercontroller, but when i check it in RemoteDebugger, it is not affected by gravity

It's not effected by gravity. You have to manually apply a normalized (0,-9.8,0) move to the controller every update

this is what my update looks like. It's mostly taken from the Physx character controller example but modified to give character a facing direction rather than just sliding around the X/Z axis.

For (X,Y,Z) X is forward/back, Z is left/right and Y is up down.

void Player::Update(double timeSinceLastFrame)
{
updateAnimations(timeSinceLastFrame);

//|||||||||||||||||||||||||||||||||||||||||||||||
// Turn
//|||||||||||||||||||||||||||||||||||||||||||||||

if (bTurnCharacter)
{
gYaw += gTurn * timeSinceLastFrame * gCharacterTurnSpeed;
mController->setDisplayYaw(gYaw);
bTurnCharacter = false;
}

//|||||||||||||||||||||||||||||||||||||||||||||||
// Movement
//|||||||||||||||||||||||||||||||||||||||||||||||
NxOgre::Vec3 disp(0,-GRAVITY,0); // default gravity

float rotation = mController->getDisplayYaw();
rotation *= 3.141592654f / 180; // Convert to radians

if(bPushCharacter)
{
NxOgre::Vec3 horizontalDisp;;
horizontalDisp.y = 0.0f;
horizontalDisp.x = gCharacterVec.z * NxOgre::Math::sin(rotation) + gCharacterVec.x * NxOgre::Math::cos(rotation);
horizontalDisp.z = gCharacterVec.z * NxOgre::Math::cos(-rotation) + gCharacterVec.x * NxOgre::Math::sin(-rotation);
horizontalDisp.normalise();
disp += horizontalDisp * gCharacterMoveSpeed;
bPushCharacter = false;
}

disp *= timeSinceLastFrame;

//|||||||||||||||||||||||||||||||||||||||||||||||
// Jump
//|||||||||||||||||||||||||||||||||||||||||||||||

float height = GetHeight(timeSinceLastFrame); // compute height(Y) in jumping
if (height != 0.0f)
{
disp.y += height;
}

unsigned int collisionFlags;
mController->move(disp,COLLIDABLE_MASK,0.000001f,collisionFlags,1.0f);
if(collisionFlags & NxOgre::Enums::ControllerFlag_Down)
StopJump(); //stop jump
}


And my move/jump/turn stuff

void Player::move(NxOgre::Vec3 dir)
{
gCharacterVec = dir;
bPushCharacter = true;
}

void Player::jump()
{
if (gJump) return;
gJumpTime = 0.0f;
gV0 = gJumpSpeed;
setBaseAnimation(ANIM_JUMP_START, true);
setTopAnimation(ANIM_NONE);
}

void Player::turn(float f)
{
gTurn = f;
bTurnCharacter = true;
}


Finally calculating height and stop jumping

float Player::GetHeight(double elapsedTime)
{
if (!gJump) return 0.0f;
float Vt = gV0 - GRAVITY*gJumpTime; // Vt = Vo + GT
gJumpTime += elapsedTime;
return Vt*elapsedTime - 1/2*GRAVITY*elapsedTime*elapsedTime; // S = VtT + 1/2GT^2
return 0.0f;
}

void Player::StopJump()
{
gJump = false;
if (mBaseAnimID == ANIM_JUMP_LOOP)
setBaseAnimation(ANIM_JUMP_END, true);
}


Sure I'm missing stuff needed for it to work (and you can ignore animation stuff)
Sure it could be written better as well, but works fine for me.

2. I manually create my character mesh in ogre, because i implement callback on ogre background resource loader. How could i associate my ogre entity with my capsulecharactercontroller?

Could just make another OGRE3DPointRenderable constructor to rather than create a mesh itself, just add the entity. (I think)

OGRE3DPointRenderable::OGRE3DPointRenderable(OGRE3DRenderSystem* renderSystem, Ogre::Entity* ogre_entity_name)
: mRenderSystem(renderSystem), mNode(0)
{
addEntity(ogre_entity_name);
}


and just feed the OGRE3DPointRenderable to your capsule controller normally

ndoxx

09-02-2010 08:13:37

Hi Tertle,

Thanks for your information, my character controller can move, but when it collide no action / callback are called.
I think this problem is very similiar to yours. Have you found any solution?

Thanks

tertle

10-02-2010 01:25:34

Nope, haven't got callbacks working, but I haven't really tried in a while.

Been trying a few other things like making a camera out of the character controller to give it collision.

pierewiet

28-02-2010 12:24:16

Hi,
When i try to do this in my code:
NxOgre::ControllerManager* m = new NxOgre::ControllerManager();

I get a dll error saying "The procedure entry point ?setWXYZ@Quat@NxOgre@@QAEXABM000@Z could not be located in the dynamic link library NxOgre_Debug.dll. What could be the cause to this? I got my linking set up properly (other NxOgre code runs just fine) and added the addon .h and .cpp files to my normal include map as well as linked to the addon lib's.

I am using Bloody Mess 1.5.5.

h4mmur4b1

02-03-2010 08:23:39

Look behind you, a three-headed monkey!

Just being serious, I think I have detected a bug while using CharacterControllers and Volumes. I've noticed when a CharacterController gets into a Volume, then the application breaks in runtime-mode before calling the onVolumeEvent function.

I've done some debug into the NxOgre code and I've discovered that the application just crashes on NxOgre::PhysicsCallback.cpp at executing the function "void PhysXCallback::onTrigger(NxShape& triggerShape, NxShape& physxCollisionShape, NxTriggerFlag status)", exactly while doing a physxCollisionShape.userData cast:


void PhysXCallback::onTrigger(NxShape& triggerShape, NxShape& physxCollisionShape, NxTriggerFlag status)
{

if (!triggerShape.getActor().userData && !physxCollisionShape.getActor().userData)
return;

Shape* volume_shape = pointer_representive_cast<Shape>(triggerShape.userData);
RigidBody* rb_volume = pointer_parent_cast<RigidBody>(triggerShape.userData);
Volume* volume = static_cast<Volume*>(rb_volume);

Shape* collision_shape = 0;
RigidBody* collision_body = 0;

if (physxCollisionShape.userData)
{
/* ---> app crashes at executing next code line ---> */
collision_shape = pointer_representive_cast<Shape>(physxCollisionShape.userData);
collision_body = pointer_parent_cast<RigidBody>(physxCollisionShape.userData);
}

volume->getVolumeCallback()->onVolumeEvent(volume, volume_shape, collision_body, collision_shape, status);
}


This cast works fine for Ogre3DBodies in general (convexes, boxes, capsules), but breaks for CharacterController.
Is there any possibility to correct this to do the casting well?

Another possibility to fix this could check if the physxCollisionShape.userData is actually a CharacterController, and then avoiding doing this cast. However, it'd be needed another way to detect a collision between a volume and CharacterController, maybe throught the CharacterControllerCallback functions. Is this possible?

Many thanks and please help me out!

betajaen

02-03-2010 09:49:12

The NxCharacterController insists in putting "CCTS" as the userData for the NxShape.

NxOgre picks this up and assumes its a PhysXPointer, as there is no reason to assume otherwise. Nobody has access to the NxShape userData, and guys we have an understanding that it shouldn't be touched if you manually import the PhysX headers/libs - right? ;).

In other parts of the code (see http://github.com/betajaen/nxogre/commi ... e1b#L9R513). I've just checked for it, and returned a partial version of the raycast (where it is, but not what it is), with triggers/volumes you can't cast a CharacterController into a RigidBody. So we may need a dedicated CharacterController Volume callback.

I was working on porting/rewriting the CC in Detritus with some ideas on how to fix these problems, but I've been rather busy lately with some different Ogre related work.

h4mmur4b1

02-03-2010 11:49:58

Many thanks for answering so soon!
Meanwhile the CharacterController Callback is not rewritten, what do you think about the following idea to fix this issue?

*** NxOgre ***
Within PhysXCallback::onTrigger(...), we can now know if the given physxCollisionShape is or not a CharacterController with this CCTS check.
- Refactor onVolumentEvent function definition to allow a new parameter (i.e a char *).
- If the physxCollisionShape is NOT a CharacterController, do the casts and proceed normally, setting this new parameter to null.
- If the physxCollisionShape is a CharacterController, get its name (physxCollisionShape->getName()) and sets the new parameter value with it.

*** Application code ***
When onVolumeEvent is called, check the new parameter we've created before:
- If it's null, it means that the physxCollisionShape was NOT a CharacterController, so we proceed normally.
- If it is NOT null, it is the name of the physxCollisionShape, which was a CharacterController.
So what we might do now is fetching the pointer related to this CharacterController according to the name received by the parameter (using a map, a vector or whatever else).
Thus we'll be able to get the pointer of the CharacterController who has entered or exited the a given volume.

Shall it work? The only problem I see is to be sure that physxCollisionShape->getName() will return the same name we've given to the CharacterController in our code. What's your oppinion?

Thanks in advance!

betajaen

02-03-2010 13:25:45

I was thinking of a having a alternative function for all callbacks in the Callback function.

Roughly:

namespace NxOgre {
class Callback {
// RigidBody
virtual void onVolumeEvent(Volume* volume, Shape* volumeShape, RigidBody* collision_body, Shape* rigidBodyShape, unsigned int collisionEvent);
virtual bool onHitEvent(const RaycastHit&);
virtual void onContact(const ContactPair&);
// Callback
virtual void onVolumeEvent(Volume* volume, Shape* volumeShape, CharacterController* char_controller, unsigned int collisionEvent);
virtual bool onHitEvent(const CharacterRaycastHit&);
virtual void onContact(const CharacterContactPair&);
};
}


As you can see it just compliments the existing Callback class.

I had another idea of having a Super RigidBody class, which everything that handles NxActors inherits from, but it would be a bit tricky to implement and not as elegant as my first solution.

h4mmur4b1

02-03-2010 14:40:02

I agree with you, first solution is more ellegant, and seems not be so difficult to develop.

Anyway, how'd you do to cast physxCollisionShape.userData to CharacterController*?
May it work a direct cast or something more difficult need to be done to convert physxCollisionShape.userData to CharacterController*?

I haven't seen the code of onHit and onContact yet, but i can figure out they'll have the same problem, so luckily same solution will be able to be applied for all :)

ekow

02-03-2010 14:42:26

can I get the RigidBody from CharacterController? I need RigidBody for raycastClosestShape (selecting CharacterController with mouse) :D

betajaen

02-03-2010 15:59:11

ekow - CharacterControllers don't inherit from RigidBodies, so that's the problem. If they did, there would be no problem in casting; It's equivalent to casting an int into a string, they are completely unrelated.

hammertime - I don't think I put the CharacterController pointer in the userData; according to Git.

You'd have to change it to "controller_desc.userData = this;" (And the one in the second constructor). Then you can static_cast it later on from the userData.

h4mmur4b1

02-03-2010 17:39:43

Now I think I understand everything needed to fix this bug, cheers!
I'm anxious to try these tips in the code ;)

h4mmur4b1

03-03-2010 12:05:08

Hi, I have fixed the bug related to CharacterControllers and Volumes, so it works fine now for me.
At the moment I have only taken care of the onVolumeEvent function, onHit and onContact still need to be revised.

These are the changes I've done in the NxOgre solution:

- Added the following function definition to NxOgreCallback.h (within class Callback).

virtual void onVolumeEvent(Volume* volume, Shape* volumeShape, void* char_controller, unsigned int collisionEvent);


- Added function content to NxOgreCallback.cpp:

void Callback::onVolumeEvent(Volume* volume, Shape* volumeShape, void* controller, unsigned int collisionEvent)
{
}


- Changed content of function onTrigger in NxOgrePhysXCallback.cpp. New function content looks like this:

void PhysXCallback::onTrigger(NxShape& triggerShape, NxShape& physxCollisionShape, NxTriggerFlag status)
{

if (!triggerShape.getActor().userData && !physxCollisionShape.getActor().userData)
return;

Shape* volume_shape = pointer_representive_cast<Shape>(triggerShape.userData);
RigidBody* rb_volume = pointer_parent_cast<RigidBody>(triggerShape.userData);
Volume* volume = static_cast<Volume*>(rb_volume);

Shape* collision_shape = 0;
RigidBody* collision_body = 0;
void* controller;

bool isCharacter = false;

if (physxCollisionShape.userData)
{
if (size_t(physxCollisionShape.userData) == 'CCTS')
{
isCharacter = true;
controller = (void*)physxCollisionShape.userData;
}
else
{
isCharacter = false;
collision_shape = pointer_representive_cast<Shape>(physxCollisionShape.userData);
collision_body = pointer_parent_cast<RigidBody>(physxCollisionShape.userData);
}
}

if (isCharacter)
{
volume->getVolumeCallback()->onVolumeEvent(volume, volume_shape, controller, status);
}
else
{
volume->getVolumeCallback()->onVolumeEvent(volume, volume_shape, collision_body, collision_shape, status);
}
}


Note 1: Focusing in your applications, you now should overwrite the desired functions inherited from NxOgre::Callback (be aware you have now two onVolumeEvent functions, both with different arguments).

Note 2: As we can see, I've used a void* instead of Controller* to store the Controller pointer because I've had some problems trying to include the NxOgreAddonController.h in the files which are into the NxOgre project. To solve this issue, as I've said before, I use void* to store the controller pointer and then, in the overwritten onVolumeEvent of my application, I do a static_cast from void* to NxOgre::Controller*. It looks like more less like this:

void PhysicsSubsystem::onVolumeEvent(NxOgre::Volume* volume, NxOgre::Shape* volumeShape, void* controller, unsigned int collisionEvent)
{
NxOgre::Controller* characterController = static_cast<NxOgre::Controller*>(controller);

// Do whatever you want
}


Maybe there'd be a better and more ellegant way to fix this issue, but at least the proposed solution works :)

ekow

03-03-2010 12:06:28

ekow - CharacterControllers don't inherit from RigidBodies, so that's the problem. If they did, there would be no problem in casting; It's equivalent to casting an int into a string, they are completely unrelated.
so, is there any alternative method to get NxCharacterController using raycast? or is there any Rigidbody implementation that works like character controller (the way its move and collide)? :?
thx anyway :D

299299

06-03-2010 05:56:54

Dont work character control. COLLIDABLE_MASK and collisionFlags what is not clear. callback = this dont work. trianle collision(*.nxs folder) dont work.
You need to set the collision flag to the triangleGeometry like this:
NxOgre::TriangleGeometry* triangleGeometry = new NxOgre::TriangleGeometry(triangleMesh);
triangleGeometry->setGroup(GROUP_COLLIDABLE_NON_PUSHABLE); :)

caifie

05-05-2010 11:26:30

is CharacterController stable now?

i'm using ogre1.7+nxogre1.5.5, and i can run them well but CharacterController.

i use CharacterController like below,

link to NxOgreAddonCharacterController_Debug.lib,
#include "NxOgreAddonCharacterController.h"

NxOgre::ControllerManager* mControllerManager;
OGRE3DPointRenderable* mControllerRenderable;
//NxOgre::PointRenderable* mControllerRenderable;
NxOgre::Controller* mController;

mControllerManager = new NxOgre::ControllerManager();

ControllerDescription desc;
desc.mPosition.set(0,3,0);
desc.mCallback = this;

mControllerRenderable = mRenderSystem->createPointRenderable("robot.mesh");
//mControllerRenderable = mRenderSystem->createPointRenderable("cube.1m.mesh");

mController = mControllerManager->createBoxController(desc, Vec3(1,1,1), mScene, mControllerRenderable );


when i cambile it, occurs the link error,
error LNK2019,
unresolved external symbol "public: class NxOgre::Controller * __thiscall NxOgre::ControllerManager::createBoxController(class NxOgre::ControllerDescription const &,class bml::Vector3<float> const &,class NxOgre::Scene *,class NxOgre::PointRenderable *)" (?createBoxController@ControllerManager@NxOgre@@QAEPAVController@2@ABVControllerDescription@2@ABV?$Vector3@M@bml@@PAVScene@2@PAVPointRenderable@2@@Z),referenced in "protected: virtual void __thiscall test_Nxogre::createScene(void)" (?createScene@test_Nxogre@@MAEXXZ)


anybody knowns why?

MortigolTheFirestorm

13-07-2010 21:52:15

Greetings,

I have run in to a bit of a problem, it seems that my character controller does not stop when it collides with anything.

Here is my code:

the collision masks

enum GameGroup
{
GROUP_NON_COLLIDABLE,
GROUP_COLLIDABLE_NON_PUSHABLE,
GROUP_COLLIDABLE_PUSHABLE,
};

#define COLLIDABLE_MASK (1 << GROUP_COLLIDABLE_NON_PUSHABLE) | (1 << GROUP_COLLIDABLE_PUSHABLE)


initialize

mControllerMgr = new NxOgre::ControllerManager();


character controller initialize

NxOgre::ControllerDescription desc;
desc.mPosition.set(0,20,0);
desc.mCallback = this;

//EDIT: oops, forgot the next line
mController = mControllerMgr->createCapsuleController( desc, NxOgre::Vec2( 1, 2 ), mScene );


make a ground plane

NxOgre::SceneGeometry *geom = mScene->createSceneGeometry( new NxOgre::PlaneGeometry( -10, NxOgre::Vec3( 0, 1, 0 ) ) );
geom->setGroup(GROUP_COLLIDABLE_NON_PUSHABLE);


moving function

unsigned int collisionFlags;
mController->move( NxOgre::Vec3( 0, grav, 0 ), COLLIDABLE_MASK, 0.000001f, collisionFlags, 1.0f );


I know that there must be nothing wrong with the simulation because I can use regular rigid bodies and they collide properly. I am at a dead and and I have no idea where the problem is happening. Thanks ahead for any help.

PS. I am compiling in release mode, not sure what differences there would be between that and debug.

EDIT: I have even tried converting over to Detritus and compiling in both debug and final modes. I also setup the visual debugger and watched the character capsule annoyingly pass through all physical objects, am I perhaps missing something? I even upgraded to the latest physx sdk 2.8.3 (previously I had 2.8.1), no luck. :(

Fr0stY

16-07-2010 05:24:06

I can't get my character to collide with the Height Field generated from Ogre::Terrain. It just falls down : \
What could be wrong? Collision flags? i'm not setting a callback, because i don't need one for my application... is it mandatory?

I think i'm using the latest update from Git.

Thanks.

betajaen

16-07-2010 13:20:09

I haven't tried it with terrain but I think you do need a callback.

[Edit]

I'm working on Beastie now, but I think I may know what is wrong. This afternoon I'll try and make a commit so you can do your callback.

Fr0stY

16-07-2010 13:36:46

I haven't tried it with terrain but I think you do need a callback.

[Edit]

I'm working on Beastie now, but I think I may know what is wrong. This afternoon I'll try and make a commit so you can do your callback.


<3 thanks a lot!

I just can't get CC to collide with the terrain... with the rest, the collisions are working.

betajaen

16-07-2010 13:41:50

Is this with the new Ogre terrain code that comes with 1.7.x? or the old Terrain code with 1.6.x?

Because we do have problems with the newer terrain code at the moment.

Fr0stY

16-07-2010 14:10:05

new ogre terrain : \ The offset problems are fixed here. I can see the physx terrain with the debug visualization.

betajaen

16-07-2010 14:29:51

And the other parts of NxOgre accurately collide with the terrain?

Fr0stY

16-07-2010 14:55:25

yes! I have a box and when i shoot it does some complex movements correctly on the floor.

Fr0stY

16-07-2010 17:27:59

I created a scene geometry, the CC doesn't collide with it and the box does.

hope this can help you solve my problem...

Fr0stY

16-07-2010 18:40:08

I solved the problem : D

I added:

mActiveGroups = COLLIDABLE_MASK

the CC can now collide with the ground and a house(static geometry). However the box is also stopping the CC's movement when it should be applying force to it and being immune to the collision result...
any thoughts?

betajaen

16-07-2010 19:40:02

I think you need to assign the box to a different group, or use a callback.

harr999y

31-07-2010 09:45:03

Hi,beatjaen.Is the new CC for 1.6 OK now?I download the file you upload from the tread http://www.ogre3d.org/addonforums/viewtopic.php?f=6&t=13038,but I can't compile it as losing function.
And I found that the NxOgre::Functions::Mesh::saveSoftBodyMesh is not implemented,is it on your TODO list?And then I change a way to use original PhysX to implement it,but I don't know how to generate the .tet file.You konw it?
Thanks for your contribution. :)
Harry.