Code: Select all
DefaultSerializer serializer = new DefaultSerializer();
serializer.StartSerialization();
convexShape.SerializeSingleShape(serializer);
serializer.FinishSerialization();
byte[] data = new byte[serializer.CurrentBufferSize];
System.Runtime.InteropServices.Marshal.Copy(serializer.BufferPointer, data, 0, data.Length);
using (var file = new System.IO.FileStream(path, System.IO.FileMode.Create))
{
file.Write(data, 0, data.Length);
}
Code: Select all
BulletWorldImporter loader = new BulletWorldImporter();
if (loader.LoadFile(path))
{
int numShape = loader.NumCollisionShapes;
Console.WriteLine(numShape);
if (numShape > 0)
{
return new (ConvexHullShape)loader.GetCollisionShapeByIndex(0);
}
}
Any tips on what the error means or how I could resolve it would be really appreciated!