Changing Mateials based on Mesh Location

Hey there

So, for a University Project in Enviroments, we were tasked with using a technique most useful to our scene and since im creating a library i thought the idea of moving books around the editor and them changing materials as they move would be really interesting. I came up with this idea after looking at the material created by Maxim Dorokhov’s Wile West Challenge enviroment. I tried and tested this but just cant seem to figure out how to get this to work. Any help will be awsome and will credit all assitance in my report. Thanks a bunch :).

Examples:

Bottle Changes:

Book Changes:

Duplicate of:

Consider deleting one of them.