Quote:
The reason of the problem is that A8 uses not the FVF definition, but a slightly different vertex declaration for the mesh. You must call D3DXCreateMesh, not D3DXCreateMeshFVF.

here is my simple example how it works:

Code:
#include <default.c>
#include <ackphysx.h>
#include <d3d9.h>

#define PRAGMA_PATH "%EXE_DIR%\samples"

#define NVB 9  // Number of Vertices
#define NIB 42 // Number of Indexes
#define NAB 14 // Number of Attributes

LPD3DXMESH pMesh;
D3DVERTEX pvb[NVB];

short pib[NIB];
long  pab[NAB];

ENTITY* ent;

function create_house(ENTITY *entity) {

	//printf("Total number of mesh vertices = %d", (long)ent_status(entity, 1));
	
	int num_triangles = NAB;
	int num_vertices  = NVB;
	
	// Vertices

	pvb[0].x = -8;pvb[0].y =  8;pvb[0].z = -8;
	pvb[1].x =  8;pvb[1].y =  8;pvb[1].z = -8;
	pvb[2].x =  8;pvb[2].y =  8;pvb[2].z =  8;
	pvb[3].x = -8;pvb[3].y =  8;pvb[3].z =  8;
	pvb[4].x = -8;pvb[4].y = -8;pvb[4].z = -8;
	pvb[5].x =  8;pvb[5].y = -8;pvb[5].z = -8;
	pvb[6].x =  8;pvb[6].y = -8;pvb[6].z =  8;
	pvb[7].x = -8;pvb[7].y = -8;pvb[7].z =  8;
	pvb[8].x =  0;pvb[8].y = 32;pvb[8].z =  0;
	
	// Triangles / Attributes
	
	pib[ 0] = 6;pib[ 1] = 2;pib[ 2] = 7; pab[ 0] = 0;
	pib[ 3] = 3;pib[ 4] = 7;pib[ 5] = 2; pab[ 1] = 1;
	pib[ 6] = 7;pib[ 7] = 3;pib[ 8] = 4; pab[ 2] = 2;
	pib[ 9] = 0;pib[10] = 4;pib[11] = 3; pab[ 3] = 3;
	pib[12] = 4;pib[13] = 0;pib[14] = 5; pab[ 4] = 4;
	pib[15] = 1;pib[16] = 5;pib[17] = 0; pab[ 5] = 5;
	pib[18] = 5;pib[19] = 1;pib[20] = 6; pab[ 6] = 6;
	pib[21] = 2;pib[22] = 6;pib[23] = 1; pab[ 7] = 7;
	pib[24] = 7;pib[25] = 4;pib[26] = 6; pab[ 8] = 8;
	pib[27] = 5;pib[28] = 6;pib[29] = 4; pab[ 9] = 9;
	pib[30] = 3;pib[31] = 8;pib[32] = 0; pab[10] = 10;
	pib[33] = 2;pib[34] = 8;pib[35] = 3; pab[11] = 11;
	pib[36] = 1;pib[37] = 8;pib[38] = 2; pab[12] = 12;
	pib[39] = 0;pib[40] = 8;pib[41] = 1; pab[13] = 13;
	
	D3DXCreateMesh(num_triangles, num_vertices, D3DXMESH_MANAGED , pvertexdecl, pd3ddev, &pMesh);

	D3DVERTEX *pnewvb;  pMesh->LockVertexBuffer(0, (void**)&pnewvb);
	short *pnewib;  pMesh->LockIndexBuffer(0, (void**)&pnewib);
	long *pnewab;  pMesh->LockAttributeBuffer(0, &pnewab);
	
	memcpy(pnewvb, pvb, num_vertices*ent_status(entity,22));
	memcpy(pnewib, pib, num_triangles*3*sizeof(short));
	memcpy(pnewab, pab, num_triangles*sizeof(long));
	
	pMesh->UnlockVertexBuffer();
	pMesh->UnlockIndexBuffer();
	pMesh->UnlockAttributeBuffer();
	
	D3DXComputeNormals(pMesh,0);

	//int entBuffer = ent_buffers(entity,0,0,&pnewvb,&pnewib,&pnewab);
	//printf("Number of triangles of the mesh = %i", entBuffer);
	
	ent_setmesh(entity, pMesh, 0, 0); //printf("ent_setmesh(entity, pMesh, 0, 0);");
	
	//int entBuffer = ent_buffers(entity,0,0,&pnewvb,&pnewib,&pnewab);
	//printf("Number of triangles of the mesh = %i", entBuffer);

	//printf("Total number of mesh vertices = %d", (long)ent_status(entity, 1));
}

function init_mesh() {
	
	ent = ent_create(CUBE_MDL, vector(-100, 0, 0), NULL);
	ent_clone(ent); set(ent, SHADOW|CAST);
	
	create_house(ent);
	wait_for(create_house);
	c_setminmax(ent);

	pXent_settype(ent,PH_RIGID,PH_CONVEX);
	wait(1);
}

function spot1() {

	set(me, SPOTLIGHT|CAST|LIGHT);
	my.lightrange = 500;
	vec_set(my.blue,vector(255,100,100));
	
	while(1) {
		my.pan += 3*time_step;
		my.tilt = -60;
		wait(1);
	}
}

function spot2() {

	set(me, SPOTLIGHT|CAST|LIGHT);
	my.lightrange = 500;
	vec_set(my.blue,vector(255,50,100));
	
	while(1) {
		my.pan -= 3*time_step;
		my.tilt = -60;
		wait(1);
	}
}

function main() {

	random_seed(0);
	vec_set(sky_color,vector(76,51,25));
	video_set(1024, 768, 32, 2);
	fps_max = 60; sun_light = 0;
	shadow_stencil = 1;
	physX_open();
	level_load("small.hmp");
	vec_set(ambient_color,vector(40,40,40));
	vec_set(camera.x,vector(-211,-77,50));
	vec_set(camera.pan,vector(35,-19,0));
	pXent_settype(level_ent,PH_STATIC,PH_POLY);
	
	init_mesh(); wait_for(init_mesh);
	int i; for(i=1;i<NAB+1;i++)
	ent_setskin(ent, bmap_fill(bmap_createblack(32,32,24),vector(50+integer(random(255)),100+integer(random(255)),100+integer(random(255))),100),i);
	ent.ambient = 50;
	//printf("Total number of model skins = %d", (long)ent_status(ent, 8));
	you = ent_create(CUBE_MDL,vector(0,0,200),spot1);
	you = ent_create(CUBE_MDL,vector(100,0,200),spot2);
	
	def_move();
	
	while(1) {
		pX_pick(); // pick and move the mesh with the cursor
		wait(1);
	}
}

function on_esc_event() {
	
	pMesh = ent_getmesh(ent,0,0);
	pMesh->Release();
	ent_setmesh(ent,0,0,0);
	sys_exit("");
}




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P