public float GetTSMHeightAt(float x, float z) { float y = 0.0f; Ray updateRay = new Ray(); updateRay.Origin = new Vector3(x, 9999, z); updateRay.Direction = Vector3.NEGATIVE_UNIT_Y; using (RaySceneQuery tsmRaySceneQuery = this.sceneMgr.CreateRayQuery(updateRay)) { using (RaySceneQueryResult qryResult = tsmRaySceneQuery.Execute()) { RaySceneQueryResult.Iterator i = qryResult.Begin(); if (i != qryResult.End() && i.Value.worldFragment != null) { y = i.Value.worldFragment.singleIntersection.y; } } this.sceneMgr.DestroyQuery(tsmRaySceneQuery); } return(y); }
private bool FrameStarted(FrameEvent evt) { // Check camera height RaySceneQuery raySceneQuery = sceneMgr.CreateRayQuery(new Ray(camera.Position + new Vector3(0, 1000000, 0), Vector3.NEGATIVE_UNIT_Y)); RaySceneQueryResult qryResult = raySceneQuery.Execute(); RaySceneQueryResult.Iterator it = qryResult.Begin(); if (it != qryResult.End() && it.Value.worldFragment != null) { if (camera.DerivedPosition.y < it.Value.worldFragment.singleIntersection.y + 30) { camera.SetPosition(camera.Position.x, it.Value.worldFragment.singleIntersection.y + 30, camera.Position.z); } it.MoveNext(); } //SkyX::AtmosphereManager::Options SkyXOptions = mSkyX->getAtmosphereManager()->getOptions(); // Time if (!showInformation) { manager.TimeMultiplier = 0.1f; } else { manager.TimeMultiplier = 0.0f; } textArea.Caption = GetConfigString(); manager.Update(evt.timeSinceLastFrame); return(true); }