Sign in to follow this  

Ageia PhysX Terrain

This topic is 3578 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
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

This topic is 3578 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this