- Home /
3 Colors on one plane
I want to have a plane with 3 colors ( red, blue, orange).
When I click on the plane I want the colors to move, like a scrollbar, where the blue line is the scroller. Lets say I click in the middle of the plane then it should look like this:
So th blue line is always where I click with the mouse. Question 1: How can I make a plane with 3 different colors. Question 2: How to move them?
Cheers Rolf
Answer by aldonaletto · Jul 09, 2013 at 05:41 PM
Create and import a texture with the desired appearance (see image below), then create a new material and assign to it this texture. Set the texture tiling X to 0.5, so that it becomes twice the plane width. Move the center point by assigning different values to material.mainTextureOffset - 0 moves the cursor fully to one side, 0.5 moves it fully to the other side, 0.25 stays at the center:
material.mainTextureOffset = Vector2(curPos, 0);
The texture should be something like this: