I’m basically talking about this effect,
How is it done? Getting the two vertexes to go to a certain position, and the seamless UV texture to stretch with it?
I’m basically talking about this effect,
How is it done? Getting the two vertexes to go to a certain position, and the seamless UV texture to stretch with it?
It’s done by magic (the node texture). I’ll write up a resource on this later today.
obligatory
import bge
from time import time
from math import sin
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
mesh = own.meshes[0]
v1, v2 = mesh.getVertex(0, 2),mesh.getVertex(0, 3)
alpha = 1 + abs(sin(time()*2)) * 10
v1.y, v2.y = alpha, alpha
v1.v, v2.v = alpha, alpha
main()
In short, edit the vertex pos and UV properties.
https://www.blender.org/api/blender_python_api_2_73_5/bge.types.KX_VertexProxy.html#bge.types.KX_VertexProxy
Didn’t know you would need magic/nodes for this kind simple thing?
:spin:
EDIT: yeah right, my bad, you need magic when you dont want to use libnew!
(see the post below)
@VegetableJuiceF:
But there are multiple vehicles, which have multiple of those pointers, so manipulating the mesh is not an option (unless I want to use LibNew, which I don’t unless absolutely necessary).
So. How is it done?
It is object-color driven UV manipulation in a node shader. Because object colour is per-instance, this means all those pointers share a mesh but can have different lengths.
*** Create a material:
The first step is to get object colour into a node shader. This is a little cryptic, and takes a few steps.
First, create a shadeless material and enable object colour:
***Add the ability to scale the texture
***Turn the material into a node material and create the following:
***Add the ability to scroll the texture
***We want to be able to scroll the texture. So we’ll modify the node setup like this:
***Controlling the Colour
***Now let’s say we want to be able to control the color. We can do that by feeding the remaining object color channel into the hue node and using it to set the colour channel:
And there we have it.
Here is the blend:
NodeUVAlter.blend (522 KB)
The scaling and position can now be altered by using obj.color in python, or animations or any other methods.
It is worth mentioning a few things:
Thanks a lot guys!