mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
Trying to fix jittery camera when being really far away from the map origin (didn't fix it yet)
This commit is contained in:
parent
bdc6a23934
commit
342ea4f518
3 changed files with 16 additions and 15 deletions
|
@ -1039,6 +1039,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public string ReadSetting(string setting, string defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
public int ReadSetting(string setting, int defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
public float ReadSetting(string setting, float defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
public double ReadSetting(string setting, double defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
public short ReadSetting(string setting, short defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
public long ReadSetting(string setting, long defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
public bool ReadSetting(string setting, bool defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const float MOVE_SPEED_MULTIPLIER = 0.001f;
|
||||
private const double MOVE_SPEED_MULTIPLIER = 0.001;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -1164,10 +1164,10 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
Vector3D camvecstrafe = Vector3D.FromAngleXY(General.Map.VisualCamera.AngleXY + Angle2D.PIHALF);
|
||||
Vector3D cammovemul = General.Map.VisualCamera.MoveMultiplier;
|
||||
Vector3D camdeltapos = new Vector3D();
|
||||
Vector3D upvec = new Vector3D(0.0f, 0.0f, 1.0f);
|
||||
Vector3D upvec = new Vector3D(0.0, 0.0, 1.0);
|
||||
|
||||
// Move the camera
|
||||
float multiplier;
|
||||
double multiplier;
|
||||
if(General.Interface.ShiftState) multiplier = MOVE_SPEED_MULTIPLIER * 2.0f; else multiplier = MOVE_SPEED_MULTIPLIER;
|
||||
if(keyforward) camdeltapos += camvec * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
|
||||
if(keybackward) camdeltapos -= camvec * cammovemul * General.Settings.MoveSpeed * multiplier * deltatime;
|
||||
|
|
|
@ -62,8 +62,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Gravity
|
||||
private Vector3D gravity;
|
||||
private float cameraflooroffset = 41f; // same as in doom
|
||||
private float cameraceilingoffset = 10f;
|
||||
private double cameraflooroffset = 41.0; // same as in doom
|
||||
private double cameraceilingoffset = 10.0;
|
||||
|
||||
// Object picking
|
||||
private VisualPickResult target;
|
||||
|
@ -1316,8 +1316,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
base.ProcessThings = (BuilderPlug.Me.ShowVisualThings != 0);
|
||||
|
||||
// Setup the move multiplier depending on gravity
|
||||
Vector3D movemultiplier = new Vector3D(1.0f, 1.0f, 1.0f);
|
||||
if(BuilderPlug.Me.UseGravity) movemultiplier.z = 0.0f;
|
||||
Vector3D movemultiplier = new Vector3D(1.0, 1.0, 1.0);
|
||||
if(BuilderPlug.Me.UseGravity) movemultiplier.z = 0.0;
|
||||
General.Map.VisualCamera.MoveMultiplier = movemultiplier;
|
||||
|
||||
// Apply gravity?
|
||||
|
@ -1330,10 +1330,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
Vector3D feetposition = General.Map.VisualCamera.Position;
|
||||
SectorLevel floorlevel = sd.GetFloorBelow(feetposition) ?? sd.Floor;
|
||||
double floorheight = floorlevel.plane.GetZ(General.Map.VisualCamera.Position);
|
||||
if(General.Map.VisualCamera.Position.z < (floorheight + cameraflooroffset + 0.1f))
|
||||
if(General.Map.VisualCamera.Position.z < (floorheight + cameraflooroffset + 0.1))
|
||||
{
|
||||
// Stay above floor
|
||||
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
||||
gravity = new Vector3D(0.0, 0.0, 0.0);
|
||||
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
||||
General.Map.VisualCamera.Position.y,
|
||||
floorheight + cameraflooroffset);
|
||||
|
@ -1342,13 +1342,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// Fall down
|
||||
gravity.z += GRAVITY * General.Map.VisualCamera.Gravity * deltatime;
|
||||
if(gravity.z > 3.0f) gravity.z = 3.0f;
|
||||
if(gravity.z > 3.0) gravity.z = 3.0;
|
||||
|
||||
// Test if we don't go through a floor
|
||||
if((General.Map.VisualCamera.Position.z + gravity.z) < (floorheight + cameraflooroffset + 0.1f))
|
||||
if((General.Map.VisualCamera.Position.z + gravity.z) < (floorheight + cameraflooroffset + 0.1))
|
||||
{
|
||||
// Stay above floor
|
||||
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
||||
gravity = new Vector3D(0.0, 0.0, 0.0);
|
||||
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
||||
General.Map.VisualCamera.Position.y,
|
||||
floorheight + cameraflooroffset);
|
||||
|
@ -1361,10 +1361,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Camera above ceiling?
|
||||
feetposition = General.Map.VisualCamera.Position - new Vector3D(0, 0, cameraflooroffset - 7.0f);
|
||||
feetposition = General.Map.VisualCamera.Position - new Vector3D(0, 0, cameraflooroffset - 7.0);
|
||||
SectorLevel ceillevel = sd.GetCeilingAbove(feetposition) ?? sd.Ceiling;
|
||||
double ceilheight = ceillevel.plane.GetZ(General.Map.VisualCamera.Position);
|
||||
if(General.Map.VisualCamera.Position.z > (ceilheight - cameraceilingoffset - 0.01f))
|
||||
if(General.Map.VisualCamera.Position.z > (ceilheight - cameraceilingoffset - 0.01))
|
||||
{
|
||||
// Stay below ceiling
|
||||
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
||||
|
@ -1374,7 +1374,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
else
|
||||
{
|
||||
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
||||
gravity = new Vector3D(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// Do processing
|
||||
|
|
Loading…
Reference in a new issue