Does mesh.transformUV change the UV's for all multi-user meshes?

(Leralasss) #1



import bge

cont = bge.logic.getCurrentController()
owner = cont.owner

mesh = owner.meshes[0]

from mathutils import Matrix as matrix
mat = matrix.Scale(2,4,(1,0,0))


change the UV for every existing object that uses the mesh?

If so, do i have to use LibNew to change it only for one object?

Solved Edit:
Yes mesh.transformUV changes UV’s for all objects that use the same mesh.


  1. use LibNew (slow)
  2. use Nodes and change UV with color (better)

(Nicholas_A) #2

I believe it does change for all users because you are still using the same mesh.

(Smoking_mirror) #3

Yes. If you want a unique mesh you need to use libnew to create a new instance.

(BluePrintRandom) #4

what about using object color float as a input into a vector for a mapping node?

like use the object color as a uv?

(sdfgeoff) #5

what about using object color float as a input into a vector for a mapping node?

This is a very very useful trick. I do it all the time.

Using LibNew is a very slow way of solving this particular issue if you need to be adding new objects mid-game.

(Leralasss) #6

ok i thought that, thanks :stuck_out_tongue:

ok thats cool, i will see what i can do (i dont use nodes in my game, because i actually dont know how to use them)

i know that its slow, thats why i asked if i had to use LibNew :stuck_out_tongue:

But i would actually use it during a Loading Screen, which leads me to another question:

the way i had it in my game was that i had many plates as wall/ground/ceiling (picture below)

yesterday i worked on merging the plates (deleting some and scaling others), thats why i want to scale the UV’s (see picture)

my question:
would it be more performance heavy for later if i used LibNew to make new Meshes for all the plates and scaled their UV? (later being: when the loading screen is gone and you walk around)


would it be better to just leave it at many plates (not merged)?

(not considering that now i know another way of doing it - with nodes)

yes i know there are no textures on the plates yet, but in case i want to add textures later (which would make it look a lot better i think) i want to do this

(Leralasss) #7

can you please show me how to change the UV with nodes? xD

think i did it :smiley:

ok is there a way to move the UV too?

i just saw that i need to move the UV by 0.5 sometimes too…

maybe use Blue and Alpha too, right now something only changes if i change Red or Green

ok the second mapping node is unneccesary

lol now it works.

here are the nodes for anyone wondering:

(sdfgeoff) #8

Do the addition before the Mapping node. Then you can move it anywhere in UVSpace.
And currently, to my disappointment, you can’t use object alpha in the node editor.

Hint: you can use splitRGB to access the individual channels of a vector. u=red v=green

Also, with that few verts, it really doesn’t matter if you merge them or not. You can successfully push nearly a million verts for the graphical side without too many issues. Physics, yeah, you’ll need a lot less than that. Limited dissolve may be your friend here…

(Leralasss) #9

oh thats nice to know with splitRGB, but somehow it now also works :stuck_out_tongue:

yes i noticed that physics are a problem, because in larger dungeons the framerate would be 2 without any enemies around (noticed that some weeks ago)

so i disable physics for everything that is not in view of the player (everything that is 2 rooms away)

What is Limited dissolve?

(Leralasss) #10

Ok so now i have another issue…

The resulting Material is Shadeless…

How do i get shade in my Nodes?

(Smoking_mirror) #11

You need a separate material node.

Is your material animated or is this just a work around to avoid having to go through and manually adjust all your UVs in blender?

I recommend only using this method for animated textures as it has quite high overhead.
I use it for switching colors of units in game, or animating water in rivers.

(sdfgeoff) #12

the framerate would be 2 without any enemies around (noticed that some weeks ago)


  • Make everything No Collision if possible
  • Character physics is expensive (apparently, I’ve never used it)
  • Use primitive bounds (eg [in order of cost] sphere, capsule, cylinder, cone, box, convex hull, triangle mesh)
  • Watch phymec’s video

You need a separate material node.

And you probably want to feed in your texture as the “color”

(Leralasss) #13

is the performance hit really big? i do this because i have plates that all use the same mesh
no the texture is not animated

thanks for that video! I think i will change the chandeliers :smiley:

ok i got it with the Nodes :stuck_out_tongue:

(Leralasss) #14

do you know how he does the linking thing in the video at 22:23

(sdfgeoff) #15

Looks like may have a script that automagically links objects in the same group with rigid body joints in a sensible way. From memory he has developed some quite advanced tools both in BPY and BGE.

(Leralasss) #16

ah ok, i thought maybe it was something easy