Recent posts en MOPP code too big <p>I experimented with a few of our levels, consisting of convex shapes (mostly boxes), and mopp code takes as much as 2.1 times more than all the convex shapes' memory. That includes the plane equations and vertices of those boxes. This seems counterintuitive, could you tell me what I'm doing wrong?</p> <p>I'm building 2120 hkpConvexVerticesShapes. Then I stick them into one hkpExtendedMeshShape using one hkpExtendedMeshShape::ShapesSubpart. And that produces over 1 Megabyte of MOPP code, more than 512 bytes per convex shape.</p> <p>Since MOPP code doesn't contain the shapes, and it's supposed to be 10-12 bytes per triangle shape, I assumed it should be about the same 10-12 bytes per convex shape. Why is it not? Is it converting it all into triangles somewhere? How to avoid that?</p> <p>I'm pretty sure something in my process is wrong, any help would be highly appreciated.</p> Wed, 26 Nov 08 21:01:34 -0800 migdalskiy 299435 convert halfspaces to convex <p>Hi,</p> <p>If I have a brush (an intersection of halfspaces in the form of plane equations), how doI make a convex shape out of it? Or a point cloud? Apart from writing it myself, of course.</p> <p>Sorry if it's been discussed before, I couldn't find it.</p> <p>Sergiy</p> Sun, 16 Nov 08 15:50:46 -0800 migdalskiy 299634 Exporting Shapes <p>Using the exporting tools I've been able to export entities with shape information from Maya.<br />This is great, but not exactly what I'm currently looking for.</p> <p>Is it possible to export a mesh as a collision shape (hkpShape)?</p> <p>If yes, how do I export it and how do I read it in such way I get a hkpShape* from the exported file?</p> <p>Kind regards,</p> <p>Remco</p> Sun, 28 Sep 08 08:48:40 -0700 vhab 300424 changing world size <p>Hi,<br />Is there a way to change the world size (i.e. broadphase size) after its creation?<br />I want to be able to load more .hkx file during the game and to make sure all rigidbodies stays inside the world (by changing the world size to include them).<br /><br />Thanks,<br />Yinon<br /></p> Sun, 21 Sep 08 02:07:20 -0700 yinono 300537 Two rigidbodies not colliding properly <p>Has anyone experienced this problem before? </p> <p>- Using autodesk maya to create 2 meshes. A box and a sphere. Sphere is a moving body falling onto the box.</p> <p>- Exported to .hkx using havok content tools. *Note transform scene was set to use SCALE_FEET_XXX</p> <p>- Confirmed with preview scene that sphere falls until it hits the box.</p> <p>- Loaded hkx unto the graphics engine</p> <p>- Sphere falls and collides somewhere in mid-air and does not seem to reach the box</p> <p>- In visual debugger the sphere falls unto the box correctly. This<br /> is the same time the sphere stops in mid-air using the main program i<br /> made.</p> <p>Currently i use hkpRigidBody getRotation() and getPosition() to<br /> update my main program's graphics object. I could adjust the bodies in<br /> my graphics program manually but i'd like to find out if there are<br /> other solutions to thisthrough havok content tools. </p> Fri, 19 Sep 08 18:51:36 -0700 gonx 300545 ~hkArray() error <p>I have this error in my engine, so, i've done a simple example, and i alsow get it. Example is next:</p> <p>I have main.cpp with code:</p> <p>#include "HavokTestFramework.h"</p> <p>boost::shared_ptr htf;</p> <p>void main()<br /><br />{<br /><br /> htf = boost::shared_ptr(new HavokTestFramework());<br /><br />}</p> <p>and HavokTestFramework.h:</p> <p>class HavokTestFramework<br /><br />{<br /><br />public:<br /><br /> HavokTestFramework();<br /><br /> ~HavokTestFramework();</p> <p> hkMemory *m_memory_manager;<br /><br /> hkThreadMemory *m_thread_memory;<br /><br /> char *m_stack_buffer;</p> <p> hkpWorld *m_world;</p> <p> static void error_report_function(const char* str, void* error_output_object)<br /><br /> {<br /><br /> printf("%s", str);<br /><br /> }<br /><br />};</p> <p>and HavokTestFramework.cpp</p> <p>#include "HavokTestFramework.h"</p> <p>HavokTestFramework::HavokTestFramework()<br /><br />{<br /><br /> m_memory_manager = new hkPoolMemory();<br /><br /> m_thread_memory = new hkThreadMemory(m_memory_manager, 16);</p> <p> hkBaseSystem::init(m_memory_manager, m_thread_memory, error_report_function);<br /><br /> m_memory_manager-&gt;removeReference();</p> <p> int stack_size = 2 * 1024 * 1024;<br /><br /> m_stack_buffer = hkAllocate(stack_size, HK_MEMORY_CLASS_BASE);<br /><br /> m_thread_memory-&gt;setStackArea(m_stack_buffer, stack_size);</p> <p> hkpWorldCinfo info;<br /><br /> info.setBroadPhaseWorldSize( 350.0f );<br /><br /> info.m_gravity.set(0, -9.8f, 0);<br /><br /> info.m_contactPointGeneration = hkpWorldCinfo::CONTACT_POINT_ACCEPT_ALWAYS;<br /><br /> info.m_collisionTolerance = 0.1f; // faster, but better 0.01f for accuracy<br /><br /> m_world = new hkpWorld(info);<br /><br />}</p> <p>HavokTestFramework::~HavokTestFramework()<br /><br />{<br /><br />m_world-&gt;markForWrite();<br /><br /> m_world-&gt;removeReference();<br /><br /> m_world = HK_NULL;</p> <p> hkMemory::getInstance().freeRuntimeBlocks();</p> <p> m_thread_memory-&gt;setStackArea(0, 0);<br /><br /> hkDeallocate(m_stack_buffer);<br /><br /> m_thread_memory-&gt;removeReference();</p> <p> hkBaseSystem::quit();<br /><br />}</p> <p>Alsow i've done all #includes of havok 5.5 framework, so i can start it.</p> <p>But when i start it, i get an unhandled exception on m_world-&gt;removeReference();</p> <p>I don't understand what is the problem.</p> <p>when i don't use boost::shared_ptr (change code of main.cpp to the): </p> <p>#include "HavokTestFramework.h"</p> <p>HavokTestFramework* htf;</p> <p>void main()<br /><br />{<br /><br /> htf = new HavokTestFramework();<br /><br /> delete htf;<br /><br />}</p> <p>it works fine. Can somebody help me?</p> Wed, 17 Sep 08 03:08:43 -0700 Solovyov Yuriy 300604 hkpRigidBody setLinearVelocity() input differs from getLinearVelocity() <p></p><p>I have a hkpRigidBody object running in my multithreaded simulation with Havok550. As a result of game logic I change the velocity of the object with setLinearVelocity(). On roughly 60% of launches of my application if I call getLinearVelocity() immediately after the set call, the velocity returned is 0, 0, 0 and the my object no longer moves.</p><br /><p>Were this merely a typical thread problem I would assume that the problem would be intermittent within that process and not occurring 100% of the time in that process or not at all. E.g. I can run my app 3-4 times and not see a problem and then launch the app again and have the problem. Any clues on what may be going on here?</p><br /><p></p><br /><p>Cheers,</p><br /><p>Jeff</p> Mon, 11 Aug 08 16:54:47 -0700 jmfreema (Intel) 301118 restrict to rotation about 1 axis in constraint <p>Hi, I'm trying to create a constraint which limits rotation to be about the Z axis, any rotation going on around any other axis should be nuked. The documentation for this is all but extensive though, save for 2 occurences in the demos, where no restriction is made and just identity used, and a 1 line comment in the documentation, one is pretty much on his own. Perhaps it's my math which is failing me.<br /><br />Anyway, I'm using the constraint construction kit and use the root fixed havok rigid body as the second body. I know that I should use some combination of setAngularBasisA and setAngularBasisB, but these accepts 3x3 matrices. I thought a matrix consisting of only 0s and a 1 on the element furthest to the bottom right would do the trick, but without luck. Would really appreciate some help on this one :)<br /></p> Mon, 14 Jul 08 07:51:13 -0700 sairon 301455 Access Violation in hkArray,inL <p></p><p>Ok, i got the linker errors straightend out thanks to Benny53, now i'm getting access violations in hkArray.inL</p><br /><p>it points to this line:</p> <pre><p>return (m_capacityAndFlags &amp; static_cast&lt;int&gt;(CAPACITY_MASK));</p><p></p><p>and here is my Initialize function:</p><p></p><p>int InitializeHavok()</p><p>{ </p><p>hkPoolMemory* MemoryManager = new hkPoolMemory(); </p><p>hkThreadMemory* Threads = new hkThreadMemory(MemoryManager, 16); </p><p>hkBaseSystem::init(MemoryManager, Threads, MessageHandler); </p><p>MemoryManager-&gt;removeReference();</p><p>{</p><p>stackBuffer;</p><p>{</p><p>int stackSize = 0x1000000;</p><p>stackBuffer = hkAllocate&lt;char&gt;( stackSize, HK_MEMORY_CLASS_BASE);</p><p>hkThreadMemory::getInstance().setStackArea( stackBuffer, stackSize);</p><p>}</p><p>PhysicalWorld;</p><p>{</p><p>hkpWorldCinfo worldInfo;</p><p>worldInfo.m_simulationType = hkpWorldCinfo::SIMULATION_TYPE_MULTITHREADED;</p><p>PhysicalWorld = new hkpWorld(worldInfo);</p><p>}</p><p>{</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(512000, HK_MEMORY_CLASS_BASE);</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(256000, HK_MEMORY_CLASS_BASE);</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(128000, HK_MEMORY_CLASS_BASE);</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(64000, HK_MEMORY_CLASS_BASE);</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(32000, HK_MEMORY_CLASS_BASE);</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(16000, HK_MEMORY_CLASS_BASE);</p><p>hkMemory::getInstance().preAllocateRuntimeBlock(16000, HK_MEMORY_CLASS_BASE);</p><p>}</p><p></p><p>PhysicalWorld-&gt;markForWrite();</p><p>{</p><p>hkpAgentRegisterUtil::registerAllAgents( PhysicalWorld-&gt;getCollisionDispatcher());</p><p>}</p><p>hkpMultithreadingUtilCinfo info;</p><p>info.m_world = PhysicalWorld;</p><p>info.m_numThreads = NUM_THREADS;</p><p>info.m_enableTimers = true;</p><p>hkpMultithreadingUtil* multithreadingutil = new hkpMultithreadingUtil(info);</p><p></p><p>//hkpPhysicsContext* context = new hkpPhysicsContext();</p><p>//hkpPhysicsContext::registerAllPhysicsProcesses();</p><p>//context-&gt;addWorld(PhysicalWorld);</p><p>//hkVisualDebugger* vdb = SetupVisualDebugger(context);</p><p>context-&gt;m_monitorStreamBegins.setSize(NUM_THREADS);</p><p>context-&gt;m_monitorStreamEnds.setSize(NUM_THREADS);</p><p>PhysicalWorld-&gt;unmarkForWrite();</p><p>}</p><p>return 1;</p><p>}</p><p></p><p>if you guys have any idea on what's going on, please let me know. i've been going crazy trying to set Havok up while other people already got a cube falling or something (Benny53!!)</p></pre> Mon, 02 Jun 08 21:23:02 -0700 havokisking3344 302051 XNA and Havok <p></p><p>Has anyone started thinking about attempting to incorporate Havok into the XNA/C# platform? I've done some work in the past incorporating C++ unmanaged dlls into a Managed DirectX (C#)project, so I imagine it would be feasible.</p><br /><p>My strategy would probably be to create a C++ dll wrapping the desired functionality of the Havok API, and then have that DLL directly communicate with Havok, trying to keep thedata to be transfered between C# and C++ as minimal as possible.</p> Mon, 02 Jun 08 05:53:40 -0700 lmdave 302071