Search Unity

Is there an API to get the drag angle while painting?

Discussion in 'World Building' started by Rowlan, Nov 22, 2019.

  1. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,294
    I keep getting asked to add a feature to have the brush paint in parallel instead of a single stroke in my free Path Paint Tool.

    Question: Is there an API to get the drag angle while painting? Basically people would like to draw lanes like roads. However, I'm thinking ahead and this might also be useful for other things like pumpkin fields and such, i. e. more than 2 lanes while painting. It's as trivial as invoking the brush painting multiple times with an offset while dragging around, like this (just texturing, no terrain modification for sake of simplicity):

    lanes.gif

    However, since the Path Paint Tool is based on the Unity Terrain Tools, I'd rather prefer to stick with what Unity provides than using my proprietary code. So I thought I'd ask if something like this is in future plans. Of course totally understandable if those plans aren't disclosed, but asking never hurts. Thank you very much :)
     
  2. wyattt_

    wyattt_

    Unity Technologies

    Joined:
    May 9, 2018
    Posts:
    424
    Do you mean the angle from previous brush position to the current one?
     
  3. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,294
    Actually more something like painting / dragging along a path. Previous to current could give wrong values because of micro-jitter. Currently I'm using some minimum distance, i. e. the angle between one of the previous brush positions to the current one.