Set mesh index type + get normal offset from mesh interface?

Xammond
Posts: 15
Joined: Sun Jan 03, 2016 4:22 pm

Set mesh index type + get normal offset from mesh interface?

Post by Xammond »

I've been trying to interpolate mesh normals from a vehicle's raycast using (forum member) Kester's code.
There are two problems at the moment: 1) btAssert(indicestype == PHY_SHORT) kicks in, and 2) manually setting a "normal offset" to external vertex normals doesn't seem to be correct.

How can the indices be set as u16 when adding triangles to the mesh?
Is there any way to access internal vertex normals, and presumably set the (u32) offset correctly - instead of as a direct memory pointer to external ones?


[strike]Update: preallocateIndices() seems to have stopped the assert. Now getting an access violating when calling raycast vehicles' updateVehicle(), I guess incorrect normals are the issue?[/strike]
<--- incorrect, assert only kicks in with debug build.

Update 2: subtracting 'vertexbase' from memory pointer has stopped the access violation, but now the suspension explodes sending the car a km away, I'm not sure if we're actually pointing at the normals or not! Hopefully someone will have some insight...
Xammond
Posts: 15
Joined: Sun Jan 03, 2016 4:22 pm

Re: Set mesh index type + get normal offset from mesh interf

Post by Xammond »

ugh! so 'btIndexedMesh' has allowed for short indices. now I'm back to versions of earlier issues.

Any suggestions are very welcome, please!

SOLVED
I was still providing normals in a non-btVector3 format after sorting the same problem with vertices.

...now to incorporate the changes in to serialization, fun =]