/// <summary> /// Serializes a collision shape and exports a .bullet file. /// </summary> /// <param name="shape">The shape you want to serialize.</param> /// <param name="name">The name of the shape - this will be used as part of its filename. "media/physics/" + name + ".bullet"</param> public void SerializeShape(CollisionShape shape, string name) { Launch.Log(string.Concat("[PhysicsMain] Serializing new bullet mesh: ", "media/", name, ".bullet...")); // so we don't have to do this in the future, we make a .bullet file out of it DefaultSerializer serializer = new DefaultSerializer(); serializer.StartSerialization(); shape.SerializeSingleShape(serializer); serializer.FinishSerialization(); var stream = serializer.LockBuffer(); // export it using (var filestream = File.Create("media/" + name + ".bullet", serializer.CurrentBufferSize)) { stream.CopyTo(filestream); filestream.Close(); } stream.Close(); }