Code: Select all
collisionMgr->calculateY(mNode, false, true, 2);
Code: Select all
collisionMgr->calculateY(mNode, false, true, 2);
Code: Select all
collisionMgr->calculateY(mNode, false, true, 2, WHATEVER_GROUND_MASK);
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
Code: Select all
/*
initETM();
createColourLayer();
setupTextures();
loadTerrain(mZoneName);
*/
Code: Select all
mCamNode->setPosition(mCamNode->getPosition().x,10000,mCamNode->getPosition().z);
// place the camera node on the ground
//mCollisionTools->calculateY(mCamNode);
Code: Select all
mCollisionTools->calculateY(mCamNode,false,true,2.0f,WATER_MASK | ENTITY_MASK);
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
Code: Select all
float HeightComputation::getHeight ( float x, float z)
{
if (_isTerrain && !_init)
{
_terrainNode = _sceneMgr->getSceneNode("Terrain");
_centerPosition = getWorldCenterPosition();
_relativePosition = getRelativeCenterPosition();
_init = true;
}
float resultat;
if ( !_isTerrain)
resultat = _defaultHeight;
else
{
Ogre::Vector3 shiftPosition (_relativePosition - _centerPosition);
Ogre::TerrainRenderable * pTerrainPage = ((Ogre::TerrainSceneManager *)_sceneMgr)->getTerrainTile(Ogre::Vector3(x +shiftPosition[0], shiftPosition[1], z +shiftPosition[2]));
if (pTerrainPage != 0)
{
resultat = pTerrainPage->getHeightAt( x +shiftPosition[0], z +shiftPosition[2]) + _defaultHeight - shiftPosition[1];
}
// Si on est en dehors de la map
else
{
OMERROR ( "Can't find terrainTile");
resultat = _defaultHeight;
}
}
return resultat;
}
Ogre::Vector3 HeightComputation::getRelativeCenterPosition() const
{
assert ( _isTerrain);
Ogre::Vector3 mapSize (((Ogre::TerrainSceneManager *)_sceneMgr)->getScale() * (((Ogre::TerrainSceneManager *)_sceneMgr)->getPageSize()-1) / 2);
return Ogre::Vector3(mapSize.x, (((Ogre::TerrainSceneManager *)_sceneMgr)->getHeightAt(mapSize.x, mapSize.z)), mapSize.z);
}
//------------------------------------------------------------
Ogre::Vector3 HeightComputation::getWorldCenterPosition() const
{
assert ( _isTerrain);
Ogre::Vector3 nodePosition = _terrainNode->getPosition();
Ogre::Vector3 mapSize (((Ogre::TerrainSceneManager *)_sceneMgr)->getScale() * (((Ogre::TerrainSceneManager *)_sceneMgr)->getPageSize()-1) / 2);
return Ogre::Vector3(nodePosition.x + mapSize.x, nodePosition.y + (((Ogre::TerrainSceneManager *)_sceneMgr)->getHeightAt(mapSize.x, mapSize.z)), nodePosition.z + mapSize.z);
}
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
Code: Select all
#define ETM_TERRAIN
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
You can create a mesh instance by ManualObject::convertToMesh().mickeyren wrote:i don't think manual objects returns these information?
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon
Code: Select all
Vector3 oldpos = m_CameraNode->getPosition();
// Translates the camera according to the translate vector
m_CameraNode->translate(m_CameraYawNode->getOrientation() * m_CameraPitchNode->getOrientation() * m_Direction, Ogre::SceneNode::TS_LOCAL);
m_pCollisionTool->calculateY(m_CameraNode,true,true,2.0f);//,ENTITY_MASK);
// When I leave this part uncommented my program simply freezes, can't use Escape to exit either so that's why I think it's an infinite loop or something but I have no idea what's causing it. I also
// commented the ENTITY_MASK because I don't have any masks right now, could that be it?
if (m_pCollisionTool->collidesWithEntity(oldpos, m_CameraNode->getPosition(), 2.5f, -1.0f))//, ENTITY_MASK))
{
// undo move
m_CameraNode->setPosition(oldpos);
}
ARTIFEX TERRA 3D - Artist-friendly, free and easy WYSIWYG realtime outdoor scene Editor & Painter
New loader now with Ogre::Terrain support: Addons for Artifex on SourceForge
MOC - Minimal Ogre Collision & Mousepicking
Simple TerrainMaterialGenerator for the use of standard Ogre material with Ogre::Terrain
Support me on Patreon