Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import minecrafttransportsimulator.sound.SoundInstance;
import minecrafttransportsimulator.systems.CameraSystem;
import minecrafttransportsimulator.systems.CameraSystem.CameraMode;
import minecrafttransportsimulator.systems.ConfigSystem;

/**
* Base class for entities that exist in the world. In addition to the normal functions
Expand Down Expand Up @@ -284,16 +285,17 @@ public boolean updateRider() {
CameraMode cameraMode = InterfaceManager.clientInterface.getCameraMode();
if (CameraSystem.activeCamera == null && cameraMode != CameraMode.FIRST_PERSON) {
riderCameraPosition.set(riderEyePosition);
RotationMatrix cameraRotation = ConfigSystem.client.renderingSettings.freecam_3P.value ? riderRelativeOrientation : rider.getOrientation();

//Adjust eye position to account for zoom settings.
int zoomRequired = 4 + zoomLevel;
riderTempPoint.set(0, 0, cameraMode == CameraMode.THIRD_PERSON ? -zoomRequired : zoomRequired).rotate(rider.getOrientation());
riderTempPoint.set(0, 0, cameraMode == CameraMode.THIRD_PERSON ? -zoomRequired : zoomRequired).rotate(cameraRotation);
riderEyePosition.add(riderTempPoint);

//Check if camera should be where eyes are, or somewhere different.
int cameraZoomRequired = 4 - InterfaceManager.clientInterface.getCameraDefaultZoom() + zoomLevel;
if (zoomRequired != cameraZoomRequired) {
riderTempPoint.set(0, 0, cameraMode == CameraMode.THIRD_PERSON ? -cameraZoomRequired : cameraZoomRequired).rotate(rider.getOrientation());
riderTempPoint.set(0, 0, cameraMode == CameraMode.THIRD_PERSON ? -cameraZoomRequired : cameraZoomRequired).rotate(cameraRotation);
riderCameraPosition.add(riderTempPoint);
} else {
riderCameraPosition.add(riderTempPoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public static class JSONRenderingSettings {

public JSONConfigEntry<Boolean> renderWindows = new JSONConfigEntry<>(true, "Should the glass on windows be rendered on vehicles?");
public JSONConfigEntry<Boolean> innerWindows = new JSONConfigEntry<>(false, "Should the glass on windows be rendered on the inside of the vehicle? Note: if renderWindows is false, this config has no effect.");

public JSONConfigEntry<Boolean> freecam_3P = new JSONConfigEntry<>(false, "If true, third-person camera rotation in vehicles is disconnected from vehicle rotation and uses only rider look rotation.");

public JSONConfigEntry<Boolean> renderFlares = new JSONConfigEntry<>(true, "If false, flares on lights will not render.");
public JSONConfigEntry<Boolean> renderBeams = new JSONConfigEntry<>(true, "If false, beams on lights will not render.");

Expand Down Expand Up @@ -86,3 +87,4 @@ public static class ConfigJoystick {
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,13 @@ public static boolean adjustCamera(IWrapperPlayer player, Point3D cameraAdjusted
//No custom cameras, check if we are sitting in a seat to adjust orientation.
if (sittingSeat != null) {
cameraAdjustedPosition.set(sittingSeat.prevRiderCameraPosition).interpolate(sittingSeat.riderCameraPosition, partialTicks);
sittingSeat.getInterpolatedOrientation(cameraRotation, partialTicks);
sittingSeat.getRiderInterpolatedOrientation(riderOrientation, partialTicks);
cameraRotation.multiply(riderOrientation);
if (ConfigSystem.client.renderingSettings.freecam_3P.value && InterfaceManager.clientInterface.getCameraMode().thirdPerson) {
sittingSeat.getRiderInterpolatedOrientation(cameraRotation, partialTicks);
} else {
sittingSeat.getInterpolatedOrientation(cameraRotation, partialTicks);
sittingSeat.getRiderInterpolatedOrientation(riderOrientation, partialTicks);
cameraRotation.multiply(riderOrientation);
}
return true;
} else {
//Not doing any camera changes.
Expand Down Expand Up @@ -163,3 +167,4 @@ private CameraMode(boolean thirdPerson) {
}
}
}