public void CreateControlPoint( ) { CurvySplineSegment prevPoint = _spline.ControlPoints [_spline.ControlPointCount - 1]; _spline.Add(); CurvySplineSegment newPoint = _spline.ControlPoints [_spline.ControlPointCount - 1]; float angle = Mathf.Sin(Time.timeSinceLevelLoad); Vector3 axis = prevPoint.transform.forward; int distance = 4; //not working?? //_offsetQuat *= Quaternion.Euler (0.0f, 0.0f, Random.Range (-4.0f, 4.0f)); //newPoint.transform.localRotation = _offsetQuat; //newPoint.transform.localEulerAngles = new Vector3( (_spline.ControlPointCount * 10.0f ) % 360.0f, newPoint.transform.localEulerAngles.y, newPoint.transform.localEulerAngles.z ); //newPoint.transform.localEulerAngles = new Vector3( 10.0f * Mathf.Sin(_spline.ControlPointCount / 2.0f), newPoint.transform.localEulerAngles.y, Mathf.Cos(Random.Range (-0.03f, 0.03f)) ); newPoint.transform.localEulerAngles = new Vector3(newPoint.transform.localEulerAngles.x, 10.0f * Mathf.Sin(_spline.ControlPointCount / 2.0f), Mathf.Cos(Random.Range(-0.03f, 0.03f))); newPoint.transform.position = prevPoint.transform.position + newPoint.transform.forward * distance; //draw red debug lines out Vector3 rightPt = new Vector3(newPoint.transform.position.x + 20.0f, newPoint.transform.position.y, newPoint.transform.position.z); Vector3 leftPt = new Vector3(newPoint.transform.position.x - 20.0f, newPoint.transform.position.y, newPoint.transform.position.z); AxKDebugLines.AddLine(newPoint.transform.position, rightPt, Color.red, 9999999.0f); AxKDebugLines.AddLine(newPoint.transform.position, leftPt, Color.red, 9999999.0f); }
/* * // Use this for initialization * public override void StartATL () { * * } * * // Update is called once per frame * public override void UpdateATL () { * * } */ public override void OnCollide() { if (Input.GetKeyDown(KeyCode.Space)) { AxKDebugLines.AddSphere(transform.position, 0.8f, Color.green, 1); } }
public void UpdateATL(PlayerController_one player_one, SplineLord_one splineLord_one) { // if (GameObject.Find ("DebugLineLord") != null) // { // _yInput += Input.mouseScrollDelta.y; // //print (_yInput); // // _offset = new Vector3 (0.0f, _yInput * sensitivity, 0.0f); // // //SplineLord splineLord = GameObject.FindObjectOfType< SplineLord > (); // CurvySpline curSpline = splineLord.GetSpline (); // // float t = curSpline.GetNearestPointTF( player_one.transform.position ); //weird to get t back from the player // _debugLineLord.transform.position = curSpline.Interpolate (t + _lead) + _debugLineLord.transform.up * _offset.y; // // _debugLineLord.transform.rotation = Quaternion.Slerp( _debugLineLord.transform.rotation, curSpline.GetOrientationFast( t + _lead ), Time.deltaTime * 5.0f ); // // } if (splineLord_one.GetSpline().IsInitialized&& !_laidOutText) { float tLineSpacing = 1.0F / _lines.Count; // the height of a line _laidOutText = true; for (int i = 0; i < _lines.Count; i++) { Vector3 upAtT = splineLord_one.GetSpline().GetOrientationUpFast(tLineSpacing * i); Vector3 alongSplineAtT = splineLord_one.GetSpline().Interpolate(tLineSpacing * (i + 1.0f)) - splineLord_one.GetSpline().Interpolate(tLineSpacing * i); Vector3 right = Vector3.Cross(alongSplineAtT, upAtT); Vector3 normal2 = Vector3.Cross(right, alongSplineAtT); Vector3 position = splineLord_one.GetSpline().Interpolate(tLineSpacing * i) + upAtT * _rise + right * .3f; Vector3 normal = splineLord_one.GetSpline().GetOrientationUpFast(tLineSpacing * i); normal = Quaternion.AngleAxis(-50.0f, right) * normal; AxKDebugLines.AddText(_lines [i], position, normal, right, upAtT, fontSizeMult, tracking, lineLengthLimit, Color.white, 9999999999999); AxKDebugLines.AddText(_lines [i], position + _offset, normal, right, upAtT, fontSizeMult, tracking, lineLengthLimit, Color.white, 9999999999999); //to make the line thicker AxKDebugLines.AddText(_lines [i], position + _offset * 2.0f, normal, right, upAtT, fontSizeMult, tracking, lineLengthLimit, Color.white, 9999999999999); AxKDebugLines.AddText(_lines [i], position + _offset * 3.0f, normal, right, upAtT, fontSizeMult, tracking, lineLengthLimit, Color.white, 9999999999999); AxKDebugLines.AddText(_lines [i], position + _offset * 4.0f, normal, right, upAtT, fontSizeMult, tracking, lineLengthLimit, Color.white, 9999999999999); } } }
public static void AddScreenSpaceRect(Vector3 center, Vector3 extents, Color color, float life = 0.0f) { AxKShape shape = Add(color, life); Camera cam = Camera.main; Vector3 c = cam.ScreenToWorldPoint(center); AxKDebugLines.AddFancySphere(c, 0.5f, Color.red); Vector3 u1 = cam.ScreenToWorldPoint(cam.transform.right * extents.x); Vector3 u2 = cam.ScreenToWorldPoint(cam.transform.up * extents.y); Vector3[] points = new Vector3[4]; points[0] = c + u1 + u2; points[1] = c + u1 - u2; points[2] = c - u1 - u2; points[3] = c - u1 + u2; shape.lines.Add(new AxKLine(points[0], points[1])); shape.lines.Add(new AxKLine(points[1], points[2])); shape.lines.Add(new AxKLine(points[2], points[3])); shape.lines.Add(new AxKLine(points[3], points[0])); m_manager.AddShape(shape); }
void Update() { _volume = GetRMS(0) + GetRMS(1); AxKDebugLines.AddFancySphere(Vector3.zero, _volume * 3.0f, Color.red, 0); print(_volume); }