@@ -43,7 +43,7 @@ core.register_entity(":__builtin:falling_node", {
43
43
textures = {},
44
44
physical = true ,
45
45
is_visible = false ,
46
- collide_with_objects = false ,
46
+ collide_with_objects = true ,
47
47
collisionbox = {- 0.5 , - 0.5 , - 0.5 , 0.5 , 0.5 , 0.5 },
48
48
},
49
49
@@ -272,9 +272,14 @@ core.register_entity(":__builtin:falling_node", {
272
272
end
273
273
274
274
local bcp , bcn
275
+ local player_collision
275
276
if moveresult .touching_ground then
276
277
for _ , info in ipairs (moveresult .collisions ) do
277
- if info .axis == " y" then
278
+ if info .type == " object" then
279
+ if info .axis == " y" and info .object :is_player () then
280
+ player_collision = info
281
+ end
282
+ elseif info .axis == " y" then
278
283
bcp = info .node_pos
279
284
bcn = core .get_node (bcp )
280
285
break
@@ -284,6 +289,20 @@ core.register_entity(":__builtin:falling_node", {
284
289
285
290
if not bcp then
286
291
-- We're colliding with something, but not the ground. Irrelevant to us.
292
+ if player_collision then
293
+ -- Continue falling through players by moving a little into
294
+ -- their collision box
295
+ -- TODO: this hack could be avoided in the future if objects
296
+ -- could choose who to collide with
297
+ local vel = self .object :get_velocity ()
298
+ self .object :set_velocity ({
299
+ x = vel .x ,
300
+ y = player_collision .old_velocity .y ,
301
+ z = vel .z
302
+ })
303
+ self .object :set_pos (vector .add (self .object :get_pos (),
304
+ {x = 0 , y = - 0.2 , z = 0 }))
305
+ end
287
306
return
288
307
elseif bcn .name == " ignore" then
289
308
-- Delete on contact with ignore at world edges
0 commit comments