Skip to content

Basic camera control API (just the mode) - #15796

Merged
sfan5 merged 1 commit into
luanti-org:masterfrom
sfan5:ccontrol
Feb 19, 2025
Merged

Basic camera control API (just the mode)#15796
sfan5 merged 1 commit into
luanti-org:masterfrom
sfan5:ccontrol

Conversation

@sfan5

@sfan5 sfan5 commented Feb 16, 2025

Copy link
Copy Markdown
Member

closes #12855

let's not bikeshed this. it's a simple and effective improvement.

To do

This PR is Ready for Review.

How to test

probably somewhat like this:

//lua =player:get_camera()
//lua player:set_camera({mode="first"})
//lua player:set_camera({mode="third"})
//lua player:set_camera({mode="asdsadasdasd"})
//lua player:set_camera({})

@sfan5 sfan5 added @ Script API @ Client / Audiovisuals Feature ✨ PRs that add or enhance a feature labels Feb 16, 2025
@sfan5
sfan5 marked this pull request as ready for review February 16, 2025 14:33
@sfan5 sfan5 changed the title Basic camera control API Basic camera control API (just the mode) Feb 16, 2025
@Andrey2470T

Copy link
Copy Markdown
Contributor

How about waiting for the SSCSM controller PR gets implemented not to do the camera control API server-oriented and not to continue "server to client" paradigm? Although this is purely a client-side feature and the server shouldn't load itself with the work which it hasn't actually to do.

@Andrey2470T

Copy link
Copy Markdown
Contributor

Also FYI you could try to adapt already the pretty ready API, but for the secondary cameras which actually could be applied to the player camera: #14325

@sfan5

sfan5 commented Feb 17, 2025

Copy link
Copy Markdown
Member Author

I explicitly don't want to wait for SSCSM to happen nor adopt a high-complexity PR.

@lhofhansl

Copy link
Copy Markdown
Contributor

I explicitly don't want to wait for SSCSM to happen nor adopt a high-complexity PR.

I agree. I like the simplicity of this (and the beginning of a Camera API that we can extend later - if we wanted to.)
Add this to core.features?

Comment thread src/client/clientevent.h

@lhofhansl lhofhansl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried. Works.
Code looks good.

Right now if if you just want to set the mode in a mod, but allow the player to still change it if wanted you'd have to do something like:

      player:set_camera({mode = "third_front"})
      minetest.after(0.1, function(player) player:set_camera({mode = "any"}) end, player)

That might be something we'd want to make easier - but not important.

@appgurueu

Copy link
Copy Markdown
Contributor

Add this to core.features?

I see no need to when users can just check if player.set_camera then ... end. Not to mention that they should ideally be doing both a serverside and a clientside availability check.

@sfan5
sfan5 merged commit ba62808 into luanti-org:master Feb 19, 2025
@sfan5
sfan5 deleted the ccontrol branch February 19, 2025 17:45
@sfan5 sfan5 mentioned this pull request Feb 27, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Force a certain camera mode

5 participants