New answers tagged

0

I happened to be writing a script that draws this kind of preview arc for a workshop I'm putting together: (Public domain art assets courtesy of Kenney) Here's the script: [RequireComponent(typeof(LineRenderer))] public class PreviewArc : MonoBehaviour { public float predictionSeconds = 4f; public int subdivisionCount = 20; LineRenderer ...


0

You are most of the way there already. The problem is, OnTriggerEnter only happens once. Quaternion.Lerp changes the value over time, at the speed specified by the timestep. Since it is only being called once, it will only move the rotation one step. In this case, .1f * Time.deltaTime is your step. This is a very small number. It needs to move that small of ...


2

Let s1 and s2 the segments, so you can calculate the angle of each using atan2(s.p1.y-s.p2.y,s.p1.x-s.p2.x) where p1 and p2 are the two points defining s; double theta1 = Math.atan2(s1.p1.y-s1.p2.y,s1.p1.x-s1.p2.x); double theta2 = Math.atan2(s2.p1.y-s2.p2.y,s2.p1.x-s2.p2.x); Taking the absolute value of the difference, you get the angle between the ...



Top 50 recent answers are included