7 [RequireComponent(typeof(Collider))]
10 [SerializeField]
private Brush brush;
12 [SerializeField]
private Camera cam;
14 [SerializeField]
private Vector3 offset;
16 [SerializeField]
private bool debugMode;
18 private RenderTexture rt;
19 private RenderTexture debug;
25 GUI.Box(
new Rect(0, 0, 200, 200),
"ReflectionImage");
26 GUI.DrawTexture(
new Rect(0, 0, 200, 200), debug);
32 rt = RenderTexture.GetTemporary(Screen.width, Screen.height, 16);
35 cam.targetTexture = rt;
40 RenderTexture.ReleaseTemporary(rt);
48 if (!collision.contacts.Any(p => p.otherCollider.GetComponent<
InkCanvas>() !=
null))
51 cam.transform.position = transform.position + offset;
53 var contact = collision.contacts.First(p => p.otherCollider.GetComponent<
InkCanvas>() !=
null);
54 var canvas = contact.otherCollider.GetComponent<
InkCanvas>();
58 GrabArea.GrabTextureWrapMode.Clamp, buf);
59 ReverseUV.Vertical(buf, buf);
62 Graphics.Blit(buf, debug);
67 canvas.Paint(brush, contact.point);
69 RenderTexture.ReleaseTemporary(buf);
Class managing brush information.
float RotateAngle
Rotate angle of the brush.
float Scale
The size of the brush. It takes a range from 0 to 1.
Texture BrushTexture
Brush texture.
Texture paint to canvas. To set the per-material.
void OnCollisionStay(Collision collision)