File tree Expand file tree Collapse file tree
Include/W3DDevice/GameClient
Source/W3DDevice/GameClient Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737// SYSTEM INCLUDES ////////////////////////////////////////////////////////////////////////////////
3838
3939// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
40+ #include " Common/MapObject.h"
4041#include " Common/STLTypedefs.h"
4142#include " GameClient/ParabolicEase.h"
4243#include " GameClient/View.h"
@@ -48,7 +49,7 @@ class Drawable;
4849// /////////////////////////////////////////////////////////////////////////////////////////////////
4950enum {MAX_WAYPOINTS=25 };
5051
51- constexpr const Real TERRAIN_SAMPLE_SIZE = 40 . 0f ;
52+ constexpr const Real TERRAIN_SAMPLE_SIZE = MAP_XY_FACTOR * 4 ;
5253
5354// ------------------------------------------------------------------------------------------------
5455// ------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -737,6 +737,24 @@ void W3DView::updateCameraTransform()
737737 Vector3 targetPos;
738738 buildCameraPosition (sourcePos, targetPos);
739739
740+ #if PRESERVE_RETAIL_SCRIPTED_CAMERA
741+ const Bool clipCameraAboveTerrain = m_isUserControlled;
742+ #else
743+ const Bool clipCameraAboveTerrain = true ;
744+ #endif
745+ if (clipCameraAboveTerrain)
746+ {
747+ // TheSuperHackers @fix Moves the camera above the terrain.
748+ // Uses averaged terrain height sampling to reduce bumpy movements.
749+ const Real minAcceptableCameraHeight = getHeightAroundPos (sourcePos.X , sourcePos.Y , MAP_XY_FACTOR) + NearZ;
750+ if (sourcePos.Z < minAcceptableCameraHeight)
751+ {
752+ const Real repositionZ = minAcceptableCameraHeight - sourcePos.Z ;
753+ sourcePos.Z += repositionZ;
754+ targetPos.Z += repositionZ;
755+ }
756+ }
757+
740758 Matrix3D cameraTransform;
741759 buildCameraTransform (&cameraTransform, sourcePos, targetPos);
742760
You can’t perform that action at this time.
0 commit comments