<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13469" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2022-08-10T16:29:16+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13469</id>

		<entry>
		<author><name><![CDATA[michaelryangreer]]></name></author>
		<updated>2022-08-10T16:29:16+00:00</updated>

		<published>2022-08-10T16:29:16+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44083#p44083</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44083#p44083"/>
		<title type="html"><![CDATA[Saving and loading collisionshapes in BulletSharp]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44083#p44083"><![CDATA[
Hey all, I know BulletSharp isn't officially supported by this forum but I figured I would post here to try and get some help. I'm trying to figure out the simplest way to save and load a ConvexHullShape in BulletSharp. Here's my current code for saving:<br><div class="codebox"><p>Code: </p><pre><code>    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></pre></div>And for loading:<br><div class="codebox"><p>Code: </p><pre><code>    BulletWorldImporter loader = new BulletWorldImporter();            if (loader.LoadFile(path))            {                int numShape = loader.NumCollisionShapes;                Console.WriteLine(numShape);                if (numShape &gt; 0)                {                    return new (ConvexHullShape)loader.GetCollisionShapeByIndex(0);                }            }</code></pre></div>When this runs, it is able to save but when I try to load it prints out an error: Failed to find DNA1+SDNA pair.<br><br>Any tips on what the error means or how I could resolve it would be really appreciated!<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14397">michaelryangreer</a> — Wed Aug 10, 2022 4:29 pm</p><hr />
]]></content>
	</entry>
	</feed>
