Need for information about collisionboxes and selectionboxes

Post Reply
oddguy117
Member
Posts: 23
Joined: Thu Nov 07, 2019 19:08

Need for information about collisionboxes and selectionboxes

by oddguy117 » Post

Dear community,
I do not actually have a problem, but I want to make some mobs (via mobs_redo) or fix the mobs from mobs_mc.
For that I need to know if there's now a way to make rotation collision boxes, because a cow with a block collision box, that doesn't even turn is awful. Also, is there a way to make advanced (maybe even dynamic, with that I mean, that the selection box changes if for example the cow walks) that fit around the mob (for that they clearly have to rotate).

Does anyone know how to help me or give me some tips?
Thanks in advance

User avatar
paramat
Developer
Posts: 3658
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Need for information about collisionboxes and selectionb

by paramat » Post

None of that is possible.
Collisionboxes are always aligned to world axes, this simplifies and increases the performance of the collision detection code, which is already intensive.
Selectionboxes are also axis-aligned, this makes the selection code simpler and high performance. A complex dynamic shape would be far more intensive to calculate selection for.
Certainly this is an issue for 'long' objects when they turn.
There have been some detailed discussions in the Github Minetest engine issues on these subjects, i suggest searching for these issues.

oddguy117
Member
Posts: 23
Joined: Thu Nov 07, 2019 19:08

Re: Need for information about collisionboxes and selectionb

by oddguy117 » Post

I guess you don't need anything more than a square colissionbox. (https://www.youtube.com/watch?v=FtNcFw3GD6A)

But ONE thing is certainly needed: rotating, dynamic and advanced selectionboxes.
I do not see where the cpu-time problem is with this, as it doesn't have to compute anything fancy.

Do you know a way in which this feature could be implemented?

User avatar
paramat
Developer
Posts: 3658
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Need for information about collisionboxes and selectionb

by paramat » Post

To clarify, by 'none of that is possible' i mean 'not possible in current MT code', i do not mean it is impossible in the future.

Although i am not an expert in this area, the issue is with the code that determiines whether a player is actually pointing at a selectionbox. The code checks for the intersection of the player view line and nearby selectionboxes, this code is much simpler if the selectionboxes are, as now, axis-aligned cuboids that do not change shape with time.

I agree that selectionboxes that more closely fit the shape of an object are 'desirable', but 'dynamic' is not essential.
See the issues at Github for more discussion.

oddguy117
Member
Posts: 23
Joined: Thu Nov 07, 2019 19:08

Re: Need for information about collisionboxes and selectionb

by oddguy117 » Post

I mean, if I make a pig with a rotating head, it would be nice if the selectionbox would change.
Also to not loose to much power I think it would be a good idea if selectionboxes that are out of reach ( hidden behind solid objects) would not be checked

User avatar
FreeGamers
Member
Posts: 608
Joined: Sat May 25, 2019 00:15
GitHub: is proprietary I use NotABug
Location: United States
Contact:

Re: Need for information about collisionboxes and selectionb

by FreeGamers » Post

It would be nice, but its not implemented at this point in time.

Some nice examples of the limitations of the current system are visible in the paleotest and draconis mods which both have mobs that are very elongated. Its not possible to accurately rotate the boxes with the entity so cubes have to suffice.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests