GameDev Xmas Challenge – Hour 9: Drawing now works!
Only one hour this time around so still a bit behind but it’ll catch up eventually. This hour however has been super-productive as drawing directly to the texture with touch input now works! Still a few knickknacks to hammer out and the drawing isn’t exactly pretty, but it’s getting there.
- Get input position in screen space (S)
- Convert S to world space (W)
- Get actor bounds and center (B and C)
- Get the world space diff (D) between W and C (W – C)
- Divide D by B to get the touch position as a percentage (P) of the drawing area
- Remap P from range (-1, 1) to (0, 1) to compensate for the pivot being in the center of the drawing area and not in the top-left
- Multiply P by the texture size (T) to get the absolute pixel on the texture touched!
PixelPos = ((W - C) / B) * T
The functional blueprint section looks like this:
The next step is probably either to link this drawing to the player markers or make the drawing prettier and crush out some bug-related crashes.
Time-lapse up as usual!