New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting custom third person front view camera offset #13686
Conversation
I'm obviously against reverting #13369. |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to also change thirdperson
to thirdperson_back
(and _third
to _third_back
etc.) instead of implying it for the back-side.
PS Thank you for creating this PR!
Missed the updates here... It just "obvious" because I had added #13369. :) Lemme test this. |
That "third person" means "third person back view" goes quite far: Line 75 in 7b3ed32
I'd prefer not to change this everywhere. However, I did change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for a single line, this PR looks good.
Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing mod: (N°144)
local V = vector.new
local PP = minetest.pos_to_string
local views = {
reset = {},
[""] = {},
-- (P1 view) up deplacement
y_z = { V(0, 10, 0), V(0, 15, 0), V() },
y_p = { V(0, 10, 0), V(0, 15, 0), V(0, 10, 0) },
y_n = { V(0, -5, 0), V(0, -10, 0), V(0, -10, 0) },
-- (P1 view) right deplacement
x_z = { V(5, 0, 0), V(10, 0, 0), V() },
x_p = { V(5, 0, 0), V(10, 0, 0), V(10, 0, 0) },
x_n = { V(-5, 0, 0), V(-10, 0, 0), V(-10, 0, 0) },
-- (P1 view) forward deplacement
z_z = { V(0, 0, 5), V(0, 0, 5), V() },
z_p = { V(0, 0, 5), V(0, 0, 5), V(0, 0, 5) },
z_n = { V(0, 0, -5), V(0, 0, -5), V(0, 0, -5) },
}
minetest.register_chatcommand("view", {
func = function(name, param)
local player = minetest.get_player_by_name(name)
local vals = views[param]
if not vals then
return false, "Unknown view type"
end
player:set_eye_offset(vals[1], vals[2], vals[3])
local v1, v3b, v3f = player:get_eye_offset()
print(PP(v1), PP(v3b), PP(v3f))
end
})
x and z work as expected but negative y values cause a close-up of the character with negative values. This behaviour does however not seem to be caused by this PR.
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
…13686) Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
…13686) Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
…13686) Co-authored-by: Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Inspired by #11965.
This PR adds a third argument called
thirdperson_front
to theset_eye_offset
Lua API function. It sets the camera offset in third-person front view and defaults tothirdperson
in order not to break backwards compatibility. This was suggested by @srifqi in #11965 (comment).Because thethirdperson_front
argument defaults tothirdperson
, not tovector.new(thirdperson.x, thirdperson.y, -thirdperson.z)
, this PR effectively reverts #13369. I did that because #13369 theoretically broke backwards compatibility by changing the behavior ofset_eye_offset
, and this compatibility break is now no longer necessary.^ This part is up for discussion.To do
This PR is a Ready for Review.
How to test
Use the
thirdperson_front
argument ofset_eye_offset
.Test some mods that use
set_eye_offset
. Verify that they behave the same as they do before this PR (i.e. thatthirdperson_front
falls back tothirdperson
if not specified).Join an old server, verify that the third person camera offset sent by the server is used in third person front view as well.