New answers tagged

1

This is known as a line-drawing algorithm. That link has multiple algorithms to solve this problem - for your case you'll want to ignore the algorithms which anti-alias. The simplest solution is the naive algorithm: dx = x2 − x1 dy = y2 − y1 for x from x1 to x2 do y = y1 + dy × (x − x1) / dx plot(x, y) (pseudocode copied from wikipedia) A more ...


3

Check if the point you get is on the far half-circle, and if it is, mirror it. Radius = 5; _randomDirection = (Vector3)(Random.insideUnitCircle).normalized; Vector3 toTarget = _target.position - _source.position; if (Vector3.Dot(toTarget, _randomDirection) > 0f) { _randomDirection = Vector3.Reflect(_randomDirection, toTarget); } Vector3 ...


Top 50 recent answers are included