Skip to content

Instantly share code, notes, and snippets.

View mmmovania's full-sized avatar

Muhammad Mobeen Movania mmmovania

  • Habib University
  • Karachi, PAKISTAN
  • 09:41 - 5h ahead
View GitHub Profile
void ShutdownVDB() {
g_pVdb->removeReference();
g_pContext->removeReference();
}
hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initDefault( hkMallocAllocator::m_defaultMallocAllocator, hkMemorySystem::FrameInfo( 500* 1024 ) );
hkBaseSystem::init( memoryRouter, OnError );
#include <GL/freeglut.h>
#include <iostream>
//Havok headers
// Keycode
#include <Common/Base/keycode.cxx>
#include <Common/Base/Config/hkProductFeatures.cxx>
void InitializeHavok() {
InitMemory();
InitPhysicalWorld();
if (g_bVdbEnabled)
InitVDB();
//new additions in SimpleBox
g_pWorld->lock();
void AddRigidBodies() {
//add the falling box
{
hkVector4 halfExtents(0.5f, 0.5f, 0.5f);
hkpBoxShape* boxShape = new hkpBoxShape(halfExtents);
hkpRigidBodyCinfo ci;
ci.m_shape = boxShape;
ci.m_position = hkVector4(0, 10, 0);
hkVector4 halfExtents(0.5f, 0.5f, 0.5f);
hkpBoxShape* boxShape = new hkpBoxShape(halfExtents);
hkpRigidBodyCinfo ci;
ci.m_shape = boxShape;
ci.m_position = hkVector4(0, 10, 0);
ci.m_motionType = hkpMotion::MOTION_DYNAMIC;
boxShape->setRadius(0.001f);
const hkReal boxMass(10.0f);
hkMassProperties massProps;
hkpInertiaTensorComputer::computeShapeVolumeMassProperties(boxShape, boxMass, massProps);
ci.setMassProperties(massProps);
hkpRigidBody* rigidBody = new hkpRigidBody(ci);
boxShape->removeReference();
box = static_cast<hkpRigidBody*>(g_pWorld->addEntity(rigidBody));
rigidBody->removeReference();
g_pWorld->markForRead();
{
//code for reading of rigid bodies and their properties
}
g_pWorld->unmarkForRead();