(solved) Collision box definition

Post Reply
User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

(solved) Collision box definition

by taikedz » Post

Hello

I am trying to find where collision_box is defined, and what its individual numbers represaent but cannot seem to see either in rubenwardy's guide nor on dev.minetest wiki any formal/detailed description....

Code: Select all

collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
I tried changing them all to 1 or 2 on a test entity but the collision box remained the same.

What do the numbers mean...?
Last edited by taikedz on Sat Sep 10, 2016 17:03, edited 1 time in total.

User avatar
qwertymine3
Member
Posts: 202
Joined: Wed Jun 03, 2015 14:33
GitHub: Qwertymine
In-game: qwertymine3

Re: Collision box definition

by qwertymine3 » Post

The numbers define the two corners of the box that the player collides with. These are relative the to center of the entity. The center of the entity is the position you get if you call get_pos().

Code: Select all

collisionbox = { --[[first corner]] x,y,z, --[[second corner]] x,y,z}
collisionbox = { x,y,z,x2,y2,z2}
The sample you gave would produce a 1*1 meter collision box where the center of the entity is in the middle of the
collision box.

2D representations:

Code: Select all

0.5|0.5
+-----+
|     | 0.5
|  o  | -
|     | 0.5
+-----+

Code: Select all

+-----+ <(0.5,0.5)
|     |
|  o  |    o = center of entity
|     |
+-----+
^(-0.5,-0.5)
Avatar by :devnko-ennekappao:

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

Re: Collision box definition

by taikedz » Post

qwertymine3 wrote:The numbers define the two corners of the box that the player collides with. These are relative the to center of the entity. The center of the entity is the position you get if you call get_pos().
Great thanks - I am pretty sure the brief trials I did ddin't make a diference, but if your notes are indeed the case, then I should probably look harder!

EDIT -- it was due to a typo. Grr.

Cheers
Last edited by taikedz on Sun Sep 04, 2016 17:43, edited 2 times in total.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Collision box definition

by azekill_DIABLO » Post

i encounter the same issue. i can't change the collision box. "collisionbox = {-0.2,-0.4,-0.2, 0.2,0.35,0.2}," still gives me a basic 1*1*1 box.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Collision box definition

by azekill_DIABLO » Post

oh sorry i found my error

'collsion_box' instead of 'collisionbox'
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
ulla
Member
Posts: 143
Joined: Wed Feb 04, 2015 09:22
GitHub: IIIullaIII
IRC: ulla
In-game: ulla

Re: (solved) Collision box definition

by ulla » Post

Hi where is the maximum collision_box dimension? example

Code: Select all

collision_box = {  
	       type = "fixed",
	        fixed = { -3.25,-0.5,-5.5, 3.25,-0.25,2.5  },
	     },
for walkable node
I make a bridge door mod for build castle but max i can collide is 4x4 block? or is my error?
X4cna2d4UqsiawIzUumDgPoYNx3JLGII

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: (solved) Collision box definition

by Krock » Post

ulla wrote:I make a bridge door mod for build castle but max i can collide is 4x4 block? or is my error?
This is not your fault. Minetest does not support larger collision boxes because of performance reasons. Here's a reported glitch caused by a large collision box, and here the rejected pull request to fix this problem.

What you can do in this case is to register multiple nodes (or blocks, as you say them in-game) and limit them to a maximum of 3x3x3 meters span.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
v-rob
Developer
Posts: 971
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: (solved) Collision box definition

by v-rob » Post

3x3x3 doesn't always work either. It's best just to register nodes and have them be placed next to each other like the homedecor mod usually does.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

User avatar
ulla
Member
Posts: 143
Joined: Wed Feb 04, 2015 09:22
GitHub: IIIullaIII
IRC: ulla
In-game: ulla

Re: (solved) Collision box definition

by ulla » Post

Krock wrote:
ulla wrote:I make a bridge door mod for build castle but max i can collide is 4x4 block? or is my error?
This is not your fault. Minetest does not support larger collision boxes because of performance reasons. Here's a reported glitch caused by a large collision box, and here the rejected pull request to fix this problem.

What you can do in this case is to register multiple nodes (or blocks, as you say them in-game) and limit them to a maximum of 3x3x3 meters span.
355/5000
Thanks for the reply, in fact I opted for 3x3, now I have to study swaps as nodes connected, considering that it is a bridge lift and makes 4 movements,
ps 3x3 works only if we start from the center, ie 1.5,0.25,1.5, -1,5,0,1,5 in my case and therefore the maximum possible collision extension for a cube is 1.5,1.5,1.5, -1.5, 0 , -1.5
Last edited by ulla on Sun Apr 08, 2018 14:15, edited 2 times in total.
X4cna2d4UqsiawIzUumDgPoYNx3JLGII

User avatar
ulla
Member
Posts: 143
Joined: Wed Feb 04, 2015 09:22
GitHub: IIIullaIII
IRC: ulla
In-game: ulla

Re: (solved) Collision box definition

by ulla » Post

v-rob wrote:3x3x3 doesn't always work either. It's best just to register nodes and have them be placed next to each other like the homedecor mod usually does.
thanks for the reply ps 3x3 works only if we start from the center,and therefore the maximum possible collision extension for a cube is 1.5,1.5,1.5, -1.5, 0 , -1.5 homedecor, has no objects larger than 3, it seems to me that the biggest is long sofa 3x1
X4cna2d4UqsiawIzUumDgPoYNx3JLGII

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests