hi there!
i need some help over here! i would like to have something like this
i have a marker in my game (fpm = first person marker
) and i would like to draw things on walls!
but i have no idea how to do this!
thanks!
hi there!
i need some help over here! i would like to have something like this
i have a marker in my game (fpm = first person marker
) and i would like to draw things on walls!
but i have no idea how to do this!
thanks!
You’re going to need a surface to paint on, either by adding numerous paint brush stroke sprites/billboards to the scene so that the become a permanent part of the scene just in front of the wall surface, or you need to have lots of empty textures mapped onto the wall geometry which you then draw to and update.
it won’t work,
it only sets pixels on one object, and i want it on all objects in my game…
var width: int;
var height: int;
var brushWidth: int;
var brushHeight: int;
var brushColor: Color;
private var transTex: Texture2D;
private var brush: Color[];
function Start() {
transTex = new Texture2D(width, height);
renderer.material.mainTexture = transTex;
Clear(transTex, Color.clear);
brush = new Color[brushWidth * brushHeight];
for (i = 0; i < brush.Length; i++) {
brush[i] = brushColor;
}
}
private var oldX: int;
private var oldY: int;
function Update () {
var hit: RaycastHit;
var camRay: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(camRay, hit) Input.GetMouseButton(0)) {
var x: int = hit.textureCoord.x * width;
var y: int = hit.textureCoord.y * height;
if ((x != oldX) || (y != oldY)) {
transTex.SetPixels(x, y, brushWidth, brushHeight, brush);
transTex.Apply();
oldX = x;
oldY = y;
}
}
}
function Clear(tex: Texture2D, clearCol: Color) {
var col: Color[] = new Color[tex.width * tex.height];
for (i = 0; i < col.Length; i++) {
col[i] = clearCol;
}
tex.SetPixels(col);
tex.Apply();
}
i found this script on the net…
http://www.arongranberg.com/unity/unitypaint/
but is it possible to add it in to 3D space?
Does it work on planes? I would use a plane with a transparent texture if it works, this is something: im curoius about too please post i f u figure out