Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Categories
- All Discussions1,524
- General534
- Graphics109
- GPU Computing419
- Mobile141
- Pro Graphics163
- Tools158
In this Discussion
- LeBoozer February 17
- Mike Skolones February 28
- ScreenOfDeath March 15
- ZokenSamurai February 14
Tags in this Discussion
- physx 272
[PHYSX] Strange Bugs on PxController - he can be pushed by PxActors without coding! Now with Video
-
Hi
I´m from germany thus english aren´t my native language.
But I hope you can understand me.
Here are some background information:
I´m programming a game and have some good experiences on C++
and PhysX and irrlicht, but irrlicht doesn´t satisfied me so I
changed to ogre.
I´ve changed my renderer engine from irrlicht to ogre - everything works.
( It was a lot of work, especially the trimesh cooker, because I didnt know ogre before)
I´ve made a new project for this conversion.
So, after changing my renderer engine, I wanted to add my entity class, which includes the
PxController. I´m using the PxCapsuleController and I can move it, it collides with
each triangle or primitive shapes. <- So that works great.
So far, in irrlicht works the collision perfect, with PhysX 3.1, 3.11, 3.2 Beta 1 or 2.
I´ve got some strange bugs and I dont know why and how it works.
If a PxRigidDynamic collides with my controller there are a big bug / bad behaivor of it.
The PxRigidDynamic moves my controller !!!! ( Without code it, that cant be true! )
And if I´m deleting the PxRigidDynamic while he is
moving my controller, it crashes sometimes - but its not findable because it crashed in
PhysX3CharacterKinematic_x86.dll at the procedure controller->move(..) !
( No other debug information are available. ! ) - it worked in irrlicht!
So, I though there are maybe a bug in my entity class, but it works 100% in irrlicht.
I can create some primitives and a controller if I push some keys to test it.
( No inherties from other classes )
SO- that same bad behaivor - each collision works, BUT the PxRigidDynamic can push
my controller around, it doesn´t matter if it was may entity controller or a "fresh"
clean controller. AND each controller CANT push any objects!! There will be pushed
by an object, and moves along while the object is moving. BUT sometimes the controller
are able to push a PxRigidDynamic for some short distance.
Example 1: Sometimes or seldom I can push a PxRigidDynamic when I try to move it ( ran against it) and change the velocity direction ( 3rd person camera).
Example 2: I can push the PxRigidDynamic while there are not on the ground - only testet while the objects are falling down, than I can move each PxRigidDynamic.
Other information:
I use PxSimulationFilterCallback and PxSimulationEventCallback and PxUserControllerHitReport
but it doesn´t matter if I "commented off" or returns only the needed values.
BUT: Another strange thing is, that the project is almost 1 : 1 converted,
only the differences between irrlicht and ogre are changed.
So, my question is how can I fix that? And how can that be possible?
I´ve tried it with Physx 3.2 Beta 1 and 2 - but both doesn´t work in ogre,
but perfekt in irrlicht. HOW CAN THAT BE?
Here are the code how I create the controller and PxActors...
// Rigid Actor
PxRigidDynamic* mActor = mPhysic->getSDK()->createRigidDynamic(PxTransform(CConvert::toPx(Vector3(50,0,0))));
PxShape* shape = mActor->createShape(PxBoxGeometry(PxVec3(1.f)),*mPhysic->getSDK()->createMaterial(0,0,0));
mActor->userData = new CPhysicActorUserData(mActor,COLLISION_GROUP_INVALID);
// mActor->setMass(1); // Doesn´t matter
mActor->setRigidDynamicFlag(PxRigidDynamicFlag::eKINEMATIC,false);
mPhysic->addUserDataToShapes(mActor);
mPhysic->getScene()->addActor(*mActor);
//Controller
PxCapsuleControllerDesc desc;
desc.material = mPhysic->mCollisionMaterial.mDefaultMaterial;
desc.height = 5;
desc.radius = 4;
desc.position = PxExtendedVec3(0,-10,0);
desc.scaleCoeff=1;
desc.climbingMode = PxCapsuleClimbingMode::eCONSTRAINED;
Con = mPhysic->getManager()->createController(*mPhysic->getSDK(),mPhysic->getScene(),desc);
I hope you can help me..
Regards,
ScreenOfDeath -
11 Comments sorted by
-
Hi,
do you have any ideas? -
Hi,
why is nobody interested to read or to solve my problem? -
It is a very weird case as you change only the graphic engine. While reading your post, the only idea I have, would be to desactivate the rigid dynamic actor associated with the controller, like the sample North Pole (SampleNorthPoleCCT.cpp):
// remove controller shape from scene query for standup overlap test
PxRigidDynamic* actor = ctrl->getActor();
if(actor)
{
if(actor->getNbShapes())
{
PxShape* ctrlShape;
actor->getShapes(&ctrlShape,1);
ctrlShape->setFlag(PxShapeFlag::eSCENE_QUERY_SHAPE,false);
}
else
fatalError("character actor has no shape");
}
else
fatalError("character could not create actor");
Hope this help. -
Hi,
first thank you for your reply.
No I´ve tried it with your code but it didn´t work.
This is a very weird case I guess, so there are no way to fix it?
But this problem is in every new project, but not in the old irrlicht project... thats cant be true. So there must be an explanation.
Regards
-
This is a copy of my other comment,
because its also fits here.
Hi,
The video file is compressed in 7zip and its about 11 mb - 1.25 minutes.
I´ve uploaded an video to show you the reports which will be sended when a PxRidigActor touches the plane. When the actor touches the plane, I print a message on the console :
"CSimulationFilterCallback : PAIR FOUND" and when it loose the contact I print
"SimulationFilterCallback : pair lost!". The controller cant send these messages and I dont know why, I guess its a limitation right now. - These messages are printed by each call directly in CSimulationFilterCallback.
( I dont show the AABB thing that I said in my thread)
But I´ve recoded another anyoing "bug" but its hard for me to explain:
The controller can move while he isn´t touching an actor. If he touchs an actor he
want to climb it and will stuck - because if I still call move() he will moves along with
the actor, ( rides on it ? ) ( undesired behavior ! )
If the actor under my character will deleted ( time experience ) and if I call move()
on my character ( for gravity or new velocity ) the game crashs. ( You will see it too in the video, at 54 sec. ) But if I dont call move(), the game wont crash. ( But I cant move my character controller )
Now I found maybe one reason which creates "the dont call move()" bug:
You have to look carefully at 48 sec and 53 sec - I move my character controller but it didnt crashed. I was standing on an actor, the first one was deleted and I´ve created some new actos, and after calling move() ( I pushed W ) my controller stands on an new item + has a new position ( THAT CANT BE!!! ) I guess PhysX remembered the last actor on which the controller stands and after calling a move() he wants to calculate something between them, but it cant work because the actor was deleted. - But the controller touched 2 other new actors, and after calling move() he stands on the last touched actor! AWESOME !
Hm, and after calling move() while the controller was standing on an actor the game crashs,
on the call of move() - but I cant debug them, I dont have any information about it.
( It crashs in the dll somewhere )
( Btw: In my other thread I say that i´ve changed only my renderer, not more and
it works with the old renderer, there are no bugs like this . Very weird ! )
So, do you have some ideas?
Regards.
Video.7z12M -
can you perhaps post the code where you update the character controller manager?
(the actual "move" method of the controller doesn't effect the physical shape, i would say. the controllers' updates are done within the manager's update methode.) -
Hi LeBoozer,
thank you for your reply.
As you can maybe read in my post, I´m using Physx 3.2 Beta,
which doesnt have an update procedure which updates controllers.
( I guess 2.8x have this procedure. )
My controller is updated only by a calling move() ->
mController->move(mVelocity,0.01f,mDeltaTime,PxControllerFilters(0));
But I´ve found a solution that doesent crashs my game anymore
( only test a few times)
I added mController->reportSceneChanged(); directly after the finished delting of
an actor, and my game doesnt crashs - that make sense. The video shows that crash on 54 sec.
So, my thoughs about PhysX doing some calculation ( sweep tests, collision etc... )
only when I update my controller by calling move is correct - and if I dont call
reportSceneChanged() PhysX thinks that he must calculate a new position based on the
sweep test etc from the "now deleted" actor. Result: It crashs the game.
So, this is fixed.
But there are still the problem that the controller can rides on the object,
( and pushing him away ). I thought kinematic actors cant be pushed by other actors.
( Without coding )
I know that there are computeInteractions() in PxControllerManager, but I guess
its only for the obstacle collision calculation, when you use it. -> Its virtual,
so I guess this methode doesnt do anything when you only use PxControllerManager, without an inherited class of it - which is used by your controllers.
( Also maybe pre and post filter methodes)
And your statement was wrong. Also the non excisting manger update methode.
Regards. -
hi,
hm...ok...i wasn't playing around this much with physx 3.x. -
Hi,
is my problem to difficult?
Isn´t there some developer from Nvidia who can help me? -
Yes, your problem is difficult. It's not easy to understand what might be different about your use case without digging into the code.
--Mike -
Hi,
I´m sorry for my late reply.
I´ve changed my code with many improvements and it should work now - but I didnt test it long enough. But I guess many problems are solved now.
Thank you for your help.
Regards.