void vHavokAiModule::OnHandleCallback(IVisCallbackDataObject_cl *pData)
{
  if (pData->m_pSender == &vHavokPhysicsModule::OnHandleResourceFile)
	{
		HandleResourceFile(*((vHavokResourceCallbackData *)pData));
	}
	else if (pData->m_pSender == &vHavokPhysicsModule::OnBeforeWorldCreated)
	{
		SetPhysicsWorld(HK_NULL);
	}
	else if (pData->m_pSender == &vHavokPhysicsModule::OnAfterWorldCreated)
	{
		vHavokPhysicsModuleCallbackData *pHavokData = (vHavokPhysicsModuleCallbackData*)pData;
		SetPhysicsWorld( pHavokData->GetHavokModule()->GetPhysicsWorld() );
	}
	else if (pData->m_pSender == &VSceneLoader::OnCustomChunkSerialization)
	{
		// Note: loading/saving of nav mesh in .vscene file is deprecated but loading is left here for backwards compatibility
		VCustomSceneChunkDataObject &chunkData(*((VCustomSceneChunkDataObject *)pData));
		if (chunkData.m_Loader.IsSaving() || chunkData.m_iChunkID == 'AINM')
		{
			chunkData.m_iChunkID = 'AINM';
			chunkData.m_bSuccess = chunkData.m_bProcessed = true;

			GlobalsChunkFileExchange(chunkData.m_Loader, chunkData.m_iChunkID);
		}
	}
	else if (pData->m_pSender == &vHavokVisualDebugger::OnCreatingContexts)
	{
		if( m_aiWorld != HK_NULL )
		{
			vHavokVisualDebuggerCallbackData_cl* pVdbData = (vHavokVisualDebuggerCallbackData_cl*)pData;
			pVdbData->m_contexts->pushBack(m_aiViewerContext);
		}
	}
	else if (pData->m_pSender == &Vision::Callbacks.OnRenderHook)
	{
		Render();
	}
	else if (pData->m_pSender == &Vision::Callbacks.OnUpdateSceneFinished)
	{
		Update();
	}
	else if(pData->m_pSender==&IVScriptManager::OnRegisterScriptFunctions)
	{
		vHavokAiModule::RegisterLua();

	}
}
示例#2
0
Scene* Tutorial::createScene()
{
	auto scene = Scene::createWithPhysics();
	scene->getPhysicsWorld()->setGravity(Vec2(0, 0));
	//scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
	auto layer = Tutorial::create();
	layer->SetPhysicsWorld(scene->getPhysicsWorld());

	scene->addChild(layer);
	return scene;
}
示例#3
0
Scene* LevelTwo::createScene()
{
	// 'scene' is an autorelease object
	auto scene = Scene::createWithPhysics();
	//scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);

	scene->getPhysicsWorld()->setGravity(Vec2(0, -300));

	auto layer = LevelTwo::create();
	layer->SetPhysicsWorld(scene->getPhysicsWorld());
	scene->addChild(layer);

	return scene;
}
示例#4
0
Scene* HelloWorld::createScene()
{
	// 'scene' is an autorelease object
	auto scene = Scene::createWithPhysics();

	scene->getPhysicsWorld()->setGravity(Vec2(0, 0));

	auto layer = HelloWorld::create();
	layer->SetPhysicsWorld(scene->getPhysicsWorld());

	scene->addChild(layer);

	return scene;
}
Scene* HelloWorld::createScene()
{
    // 'scene' is an autorelease object
    auto scene = Scene::createWithPhysics();
    scene->getPhysicsWorld()->setDebugDrawMask( PhysicsWorld::DEBUGDRAW_ALL );
    
    // 'layer' is an autorelease object
    auto layer = HelloWorld::create();
    layer->SetPhysicsWorld( scene->getPhysicsWorld() );

    // add layer as a child to scene
    scene->addChild(layer);

    // return the scene
    return scene;
}
示例#6
0
Scene* GameScene::createScene()
{
	// 'scene' is an autorelease object
	auto scene = Scene::createWithPhysics( );
	scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_NONE);
	scene->getPhysicsWorld()->setGravity( Vect(0.0f, 0.0f) );

	// 'layer' is an autorelease object
	auto layer = GameScene::create();
	layer->SetPhysicsWorld( scene->getPhysicsWorld() );

	// add layer as a child to scene
	scene->addChild(layer);

	// return the scene
	return scene;
}
示例#7
0
Scene* GameScene::createScene()
{
	// 'scene' is an autorelease object
	auto scene = Scene::createWithPhysics();
	//let see colision
	//scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
	//make gravity
	scene->getPhysicsWorld()->setGravity(Vect(0, 0));

	// 'layer' is an autorelease object
	auto layer = GameScene::create();
	layer->SetPhysicsWorld(scene->getPhysicsWorld());

	// add layer as a child to scene
	scene->addChild(layer);

	// return the scene
	return scene;
}
/// Called by the Havok physics module on de-initialization. It is called before anything
/// was actually deleted, with the hkpWorld marked for write.
void vHavokAiModule::OnDeInitPhysicsModule()
{
	SetPhysicsWorld(HK_NULL);
}