What i want to do:

If player/ avatar is close to an object, objects texture changes to a higher rez one/ object changes material.

  • How to get distance between two objects using script?
  • How to apply/change texture to an object using script?

1 Answer 1


You don't even need to write python code, you can change the material with level of detail (LOD)

enter image description here

Create different objects (or duplicate the same mesh Shift-D if don't want lower polygon count)

  • Assign the textures to the objects -
  • And all to the highest resolution object as LOD objects.
  • Adjust the distance for where they should be displayed.
  • Move all but the highest resolution object to an invisble layer.

The effect is visible in the viewport:

enter image description here

A python soultion would be to combine snippets from:

  • $\begingroup$ Thanks but i want it to be done in/by python script. Not by changing objects. $\endgroup$
    – EwwGin
    Jan 2, 2015 at 15:21
  • $\begingroup$ @EwwGin I just linked two posts containing the snippets you need. $\endgroup$
    – stacker
    Jan 2, 2015 at 15:53
  • $\begingroup$ Umm. i need it ( changing materials ) to happen in bge / while >game< is running. if possible. $\endgroup$
    – EwwGin
    Jan 3, 2015 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.