-
Notifications
You must be signed in to change notification settings - Fork 2k
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
add "on_collision" callbacks for entities #5458
Comments
It would be very useful if it can be done without much lag. |
this would be a nice feature, especially if done in a way that players can also use it. A few mods, eg: mesecons, currently use on_globalstep to detect if a player is stepping on a node. |
@rubenwardy |
This is very important for anything dynamic. There is an almost infinite number of use cases for this, some examples were posted before. |
Related issues:
|
We really need this callback. I looked through some "archery" mods and all of them check collision using on_step callback, some of them even calculate collisions with collisions boxes, while obviously this work already done in core (physical = true and collide_with_objects = true). I tried tracking speed changes with physical = true to notice collisions, it worked but looked hacky. |
@SmallJoker is working on a bows mod that uses raycast to detect objects on the shoot line. |
Well, that might work, but I think that doesn't help for many other use cases. Arrows are small objects. A raycast may work. How many rays do you want to cast if you have bigger objects? |
Yes, i was just replying to xunto's usecase. |
@paramat Hmm, maybe I should try it. Even though I've already written collision check in lua for my spellcasting mod. |
@paramat Please note that raycast does not handle collisions (walkable and collision box values) and is more suitable to get a pointed thing with a direction and position given. For bigger objects, each collision box edge would have to be cast, which seems to be more hacky than simply using the |
duplicate of #3918 |
I propose to add two functions for entities
on_entity_collision()
If two entities collide the callback from both entities is called with a reference to the other entity
on_node_collision()
this callback is called every time an entity hits a new node. So if an entity doesn't moves over the surface this callback wouldn't be called. If an entity enters a new node or hits a node in front the callback is called with the pos of the node
I think this would be very useful for mods like bows and arrows or for mobs
The text was updated successfully, but these errors were encountered: