Jump to content
  • Advertisement
Sign in to follow this  
D3DXVECTOR3

Ageia PhysX Terrain

This topic is 3795 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My objects wont go below y=0 even though I have set my groundplane to -9999; Above y=0 the object collide nice with the terrain and follow the contours of it. Here is how I create the terrain desc:
NxTriangleMeshDesc mTerrainBlockDesc;
mTerrainBlockDesc.numVertices 			= mVertexBuffer.Size();
mTerrainBlockDesc.numTriangles 			= mIndexBuffer.Size() / 3;
mTerrainBlockDesc.pointStrideBytes		= sizeof(Vec3f);
mTerrainBlockDesc.triangleStrideBytes		= 3*sizeof(unsigned int);
mTerrainBlockDesc.points			= mVertexBuffer.Vertices();
mTerrainBlockDesc.triangles			= mIndexBuffer.Indices();
mTerrainBlockDesc.heightFieldVerticalAxis	= NX_Y;
mTerrainBlockDesc.heightFieldVerticalExtent	= -9999;

And here is how I create the triangle mesh:
NxActor* NxPhysX::CreateTriangleMesh(NxTriangleMeshDesc& desc)
{
	NxTriangleMeshShapeDesc shapedesc;

	// Cooking from memory
	NXU::MemoryWriteBuffer buffer;
	if(_NxCookingInterface->NxCookTriangleMesh(desc, buffer))
	{
		shapedesc.meshData = _PhysicsSDK->createTriangleMesh(NXU::MemoryReadBuffer(buffer.data));

		if (shapedesc.meshData)
		{
			NxActorDesc actorDesc;
			actorDesc.shapes.pushBack(&shapedesc);
			NxActor* actor = _NxScene->createActor(actorDesc);

			return actor;
		}
	}

	return NULL;
}

Share this post


Link to post
Share on other sites
Advertisement
The only groundplane I have created it this one:


NxPlaneShapeDesc planeDesc;
planeDesc.d = -2000;

NxActorDesc actorDesc;
actorDesc.shapes.pushBack(&planeDesc);

mNxScene->createActor(actorDesc);




Removing it doenst help. When removing the terrain all object drop down to the expected -2000;

Share this post


Link to post
Share on other sites
Hm your code looks normal, except the heightFieldVerticalExtent default is -1000.0
Can't imagine why you have it set 8k below your ground plane's position?

Only other suggestion is to move the triangle mesh up, so it's lowest point is at 0.0
But you shouldn't have to, I've never had this problem with a -1000.0 limit or not setting a limit (not recommended)

Share this post


Link to post
Share on other sites
I found the problem.
http://members.home.nl/skynet2097/Temp/01.PNG

Terrain object and Water are of the same class. so I was automaticly creating a NxTriangleMeshDesc mTerrainBlockDesc; for the water also.

stupid stupid stupid

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!