DirectX and PhysX

Started by
20 comments, last by Viperrr 15 years, 9 months ago
Quote:Original post by teutonicus
The PhysX SDK comes with an interactive debugger ... it's a long time since I've used it but I remember it being very helpful. You can also get PhysX to spit out buffers full of vertices for rendering debug shapes in-game. Rendering these will give you a visual representation of the actual PhysX actors (including character controller) within your scene. It's all in the docs :)


Yes thank you, that is what I was talking about :) I understand PhysX and DirectX are seperate, but if I know how to make PhysX "spit out" these buffers, I can use D3D to render them!

Why are you guys talking about matrices for the positioning of meshes tho? The documentation mentions a simple function like NxActor->getPos (or something similar). This would just return x,y and z.

Well regardless of all of this, a tutorial on how to setup up the charactercontroller would still be helpfull :)
Advertisement
Quote:Why are you guys talking about matrices for the positioning of meshes tho? The documentation mentions a simple function like NxActor->getPos (or something similar). This would just return x,y and z.


all transforms are applied using matrices in directX (and openGL for that matter) - you can either get the matrix directly from physX returning 16 floats which can be applied directly to your directX device to represent position AND rotation... or you can use the get-position / get-rotation functions which will then return NxVector3 vectors which then end up having to be packed into a matrix anyway (by your program at some level) before they can be applied to your DirectX geometry. thats why.
Question:

My app DOES compile, but crashes immediately, why?

[source lang=cpp]NxControllerManager* pManager;NxController* playerController;initPhysX(){        <...>	pManager = NxCreateControllerManager(NULL);	NxCapsuleControllerDesc desc;	desc.height = 1.5f;	desc.radius = 0.5f;	playerController = pManager->createController(pScene, desc);}


When I comment out the last line it doesnt crash anymore. What am I doing wrong?
Please help
http://www.inf.ufrgs.br/~dlmtavares/graduate/INF01019/Tutorial_PhysX_01.pdf
That tutorial is missing some pages. In the menu it says chapter 4 is about charactercontrol, but there is no chapter 4 :S

Also it seems to be about the irrlicht engine. I dont want to use any 3rd party engine stuff. Just DirectX, PhysX and C++

Hasn't anybody here ever made a first person shooter?
bump
Hi, it seems that not many people its using directx and physx together,
but in fact its quite simple, the "only" thing you need to do, its apply
the actor matrix directly to your desired mesh of that actor.

Now, i could not get character controller to work, its a lot o things and you
are limited to use a capsule, instead i did my own way to controll my actor
without use that thing, and with the feature of using a convex, not a cube
nor a capsule.

NxVec3 tmp = fpsactor->getGlobalPosition();
tmp.z += TIMECONSTANT*cos(angle);
tmp.x += TIMECONSTANT*sin(angle);
fpsactor->setGlobalPosition(tmp);

In this code, angle its your rotation on Y Axis, now you can move
your actor without using forces, and the matrix pose of the fpsactor
of this code should be applied to your mesh of directx directly.

I hope that can help, and sorry my grammar =/
you should maybe read the documentation + know how to debug::::!!!!!

NxControllerManager* pManager;
NxController* playerController;

initPhysX()
{
<...>

pManager = NxCreateControllerManager(NULL);
NxCapsuleControllerDesc desc;
desc.height = 1.5f;
desc.radius = 0.5f;
playerController = pManager->createController(pScene, desc);
}


pManager = NxCreateControllerManager(NULL); //after this line pManager is Zero for sure cos NxCreateControllerManager needs a NxUserAllocator

playerController = pManager->createController(pScene, desc); //since pManager is zero this will cause a exception.

The Solution::

do not give NULL to NxCreateControllerManager, derive from NxUserAllocator and pass the derived class check:::

AgeiaPhysXDocumentation/Guide/Basics/MemoryManagement how to do that
Alright thanks. I thought passing NULL would make it use a default allocator. Guess not.

This topic is closed to new replies.

Advertisement