[solved] Invisible collision wall...

Place to get help with not working mods / modding interface.
Post Reply
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

[solved] Invisible collision wall...

Post by aubergine18 »

I'm trying to make an invisible collision wall out of simple-entity objects, with the aim of creating two parallel lines, one either side of a bridge to stop player wandering off a bridge on to adjacent land tiles.

Sort of like this (was testing the entities, manually placed):

Image

The collision box must contain the 0,0 point (centre of entity) for some reason, so I've had to allow these things to be off-map to place them in desired locations.

Problem I'm having is that the player character seems to magically run through them. At first I thought it was just the slide distance of the character, and that does seem to be happening, but if there's a line of the entities with not enough space to squeeze through the character collision box, the character shouldn't be able to run between the entity collision boxes... but it does, giving the appearance that they're not even there.

Any ideas?
Last edited by aubergine18 on Mon Oct 17, 2016 7:55 pm, edited 1 time in total.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5151
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Invisible collision wall...

Post by Klonan »

I suppose you are making them a width of 0?

Try making them like:

Code: Select all

 collision_box = {{-0.5, -0.05},{0.5, 0.05}} 
It should work

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Invisible collision wall...

Post by aubergine18 »

0.001 actually :lol:

Code: Select all

    collision_box = { {-0.5,-0.001}, {0.5,0} },
I'll increase it a bit and see if that helps. Thanks for the infos!
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Invisible collision wall...

Post by aubergine18 »

Yup, that solved it! Seems anything less than 0.1 is unreliable at stopping player running through it.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Invisible collision wall...

Post by Nexela »

Check with power armor full of exoskeletons also

Rseding91
Factorio Staff
Factorio Staff
Posts: 13235
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [solved] Invisible collision wall...

Post by Rseding91 »

Because of the fixed-point number system we use for entity positions there are only 255 unique positions on a given tile that are usable. Everything between them is rounded to the nearest fraction.

So, [0, 1] in increments of 1/255 (0.003921568627451). A bounding box of 0.001 width would indeed end up a bounding box of 0 width.
If you want to get ahold of me I'm almost always on Discord.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [solved] Invisible collision wall...

Post by aubergine18 »

Ah, that is hugely useful to know! This explains many issues I was having across the various mods I was working on. Thank you!

/me goes to fix myriad of buglets in mods
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Post Reply

Return to “Modding help”