Created
February 10, 2021 16:39
-
-
Save andybak/4bad9d7e5912f181148d97187d299368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Not working. | |
// Creates a batch that appears to have geometry but nothing is visible in the scene | |
override public void UpdateTool() | |
{ | |
base.UpdateTool(); | |
Transform rAttachPoint = InputManager.Brush.Geometry.ToolAttachPoint; | |
Vector3 pos = rAttachPoint.position; | |
Quaternion rot = rAttachPoint.rotation; | |
m_toolDirectionIndicator.transform.localRotation = Quaternion.Euler(PointerManager.m_Instance.FreePaintPointerAngle, 0f, 0f); | |
uint time = 0; | |
if (InputManager.m_Instance.GetCommandDown(InputManager.SketchCommands.Activate)) | |
{ | |
float pressure = 10; | |
var stroke = new Stroke | |
{ | |
m_Type = Stroke.Type.NotCreated, | |
m_IntendedCanvas = App.Scene.ActiveCanvas, | |
m_BrushGuid = PointerManager.m_Instance.MainPointer.CurrentBrush.m_Guid, | |
m_BrushScale = 1f, | |
m_BrushSize = PointerManager.m_Instance.MainPointer.BrushSize01, | |
m_Color = PointerManager.m_Instance.MainPointer.GetCurrentColor(), | |
m_Seed = 0, | |
m_ControlPoints = new[] | |
{ | |
new PointerManager.ControlPoint {m_Pos=pos, m_Orient=rot, m_Pressure=pressure, m_TimestampMs=time++}, | |
new PointerManager.ControlPoint {m_Pos=pos + new Vector3(1f, 0, 0), m_Orient=rot, m_Pressure=pressure, m_TimestampMs=time++}, | |
new PointerManager.ControlPoint {m_Pos=pos + new Vector3(0, 1, 0), m_Orient=rot, m_Pressure=pressure, m_TimestampMs=time++}, | |
new PointerManager.ControlPoint {m_Pos=pos, m_Orient=rot, m_Pressure=pressure, m_TimestampMs=time++} | |
} | |
}; | |
stroke.m_ControlPointsToDrop = Enumerable.Repeat<bool>(false, stroke.m_ControlPoints.Length).ToArray(); | |
stroke.Recreate(App.Scene.ActiveCanvas.AsCanvas[rAttachPoint], App.Scene.ActiveCanvas); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment