Conversation
beanbag44
left a comment
There was a problem hiding this comment.
really cool, didnt know it would act like a string attached to the player. Some changes tho
|
|
||
| private fun Vec2d.normalize(): Vec2d { | ||
| val length = distanceTo(Vec2d(0.0, 0.0)) | ||
| return if (length > 0) Vec2d(x / length, y / length) else Vec2d(0.0, 0.0) |
| return players.minByOrNull { it.eyePos.squaredDistanceTo(position) } | ||
| } | ||
|
|
||
| private fun Vec2d.distanceTo(other: Vec2d): Double { |
There was a problem hiding this comment.
we have the dist functions in Vectors.kt, could prob just add the extension functions for dist and distSq in there for Vec2d
| if (player.gameMode != GameMode.SPECTATOR) { | ||
| return player | ||
| } | ||
| val players = world.players.filter { it != player && it !is ClientPlayerEntity } |
There was a problem hiding this comment.
could remove the it != player check as the ClientPlayerEntity check already acounts for that
| } | ||
| } | ||
|
|
||
| enum class FreecamRotationMode(override val displayName: String, override val description: String) : NamedEnum, Describable { |
There was a problem hiding this comment.
usually for local private enums i dont bother with the name prefix and just use RotationMode or Mode for example. Also these could be private
| private val keepYLevel by setting("Keep Y Level", false, "Don't change the camera y-level on player movement. Applies to relative and follow modes") | ||
|
|
||
|
|
||
| override val rotationConfig = RotationConfig.Instant(RotationMode.Lock) |
There was a problem hiding this comment.
this should be applied using setDefaultAutomationConfig { hideAllGroupsExcept(rotationConfig) } or something like that in the init block before the listeners
| FreecamRotationMode.None -> return@listen | ||
| FreecamRotationMode.KeepRotation -> rotationRequest { rotation(rotation) }.submit() | ||
| FreecamRotationMode.LookAtTarget -> mc.crosshairTarget?.let { | ||
| runSafeAutomated { |
There was a problem hiding this comment.
i dont think runSafeAutomated is required here
Adds a follow mode to freecam that keeps the freecam camera close to the player but only moves it if the player is moving away. This also adds an option in follow mode to track the player's eye position with the camera.
tracking.freecam.mp4