further documentation and cleaner code

This commit is contained in:
Sjoerd van de Goor 2023-02-15 14:14:26 +01:00
parent e94406fb45
commit 2a95edd860
2 changed files with 4 additions and 3 deletions

View File

@ -495,7 +495,7 @@ public class IrisObject extends IrisRegistrant {
IObjectPlacer placer = (config.getHeightmap() != null) ? new HeightmapObjectPlacer(oplacer.getEngine() == null ? IrisContext.get().getEngine() : oplacer.getEngine(), rng, x, yv, z, config, oplacer) : oplacer;
// Rotation calculation
double slopeRotationY = 0;
int slopeRotationY = 0;
ProceduralStream<Double> heightStream = rdata.getEngine().getComplex().getHeightStream();
if (config.isRotateTowardsSlope()) {
// Whichever side of the rectangle that bounds the object is lowest is the 'direction' of the slope (simply said).
@ -514,7 +514,8 @@ public class IrisObject extends IrisRegistrant {
slopeRotationY = 270;
}
}
config.getRotation().setYAxis(new IrisAxisRotationClamp(true, false, slopeRotationY, slopeRotationY, 360));
double newRotation = config.getRotation().getYAxis().getMin() + slopeRotationY;
config.getRotation().setYAxis(new IrisAxisRotationClamp(true, false, newRotation, newRotation, 360));
config.getRotation().setEnabled(true);
if (config.isSmartBore()) {

View File

@ -63,7 +63,7 @@ public class IrisObjectPlacement {
@Desc("Whether or not this object can be targeted by a dolphin.")
private boolean isDolphinTarget = false;
@Desc("Set to true to add the rotation of the direction of the slope of the terrain (wherever the slope is going down) to the y-axis rotation of the object." +
"Overwrites the y-axis of the rotation settings if set to true, and force-enables it. This is rounded by 90 degrees as to not fuck up your objects.")
"Rounded to 90 degrees. Adds the *min* rotation of the y axis as well (to still allow you to rotate objects nicely). Discards *max* and *interval* on *yaxis*")
private boolean rotateTowardsSlope = false;
@MinNumber(0)
@MaxNumber(1)