1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add object's own position for each collision to moveresult (#14608)

This commit is contained in:
grorp 2024-05-05 13:28:59 +02:00 committed by GitHub
parent d7f9da49eb
commit af8cb63292
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 6 deletions

View file

@ -40,6 +40,7 @@ core.features = {
lsystem_decoration_type = true,
item_meta_range = true,
node_interaction_actor = true,
moveresult_new_pos = true,
}
function core.has_feature(arg)

View file

@ -103,7 +103,7 @@ if core.set_push_moveresult1 then
-- must match CollisionAxis in collision.h
local AXES = {"x", "y", "z"}
-- <=> script/common/c_content.cpp push_collision_move_result()
core.set_push_moveresult1(function(b0, b1, b2, axis, npx, npy, npz, v0x, v0y, v0z, v1x, v1y, v1z)
core.set_push_moveresult1(function(b0, b1, b2, axis, npx, npy, npz, v0x, v0y, v0z, v1x, v1y, v1z, v2x, v2y, v2z)
return {
touching_ground = b0,
collides = b1,
@ -112,8 +112,9 @@ if core.set_push_moveresult1 then
type = "node",
axis = AXES[axis],
node_pos = vector.new(npx, npy, npz),
old_velocity = vector.new(v0x, v0y, v0z),
new_velocity = vector.new(v1x, v1y, v1z),
new_pos = vector.new(v0x, v0y, v0z),
old_velocity = vector.new(v1x, v1y, v1z),
new_velocity = vector.new(v2x, v2y, v2z),
}},
}
end)