LineRenderer
Добавлено: 23 янв 2020, 20:01
Здравствуйте , пытаюсь изобразить синус функцию с помощью рендера линий, но застрял на ошибке вызова этой функции не могу разобраться, ошибка вида: error CS7036: There is no argument given that corresponds to the required formal parameter 'startPoint' of 'NewBehaviourScript.DrawSineWave(Vector3, float, float)'
Сам код:
Итог который пытаюсь получить:
Подскажите , где допустил ошибку, благодарю.
Сам код:
Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private LineRenderer lineRenderer;
// Start is called before the first frame update
void Start()
{
lineRenderer = GetComponent<LineRenderer>();
DrawSineWave();
}
void DrawSineWave(Vector3 startPoint, float amplitude, float wavelength)
{
float x = 0f;
float y;
float k = 2 * Mathf.PI / wavelength;
lineRenderer.positionCount = 200;
for (int i = 0; i < lineRenderer.positionCount; i++)
{
x += i * 0.001f;
y = amplitude * Mathf.Sin(k * x);
lineRenderer.SetPosition(i, new Vector3(x, y, 0) + startPoint);
}
}
// Update is called once per frame
void Update()
{
}
}
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private LineRenderer lineRenderer;
// Start is called before the first frame update
void Start()
{
lineRenderer = GetComponent<LineRenderer>();
DrawSineWave();
}
void DrawSineWave(Vector3 startPoint, float amplitude, float wavelength)
{
float x = 0f;
float y;
float k = 2 * Mathf.PI / wavelength;
lineRenderer.positionCount = 200;
for (int i = 0; i < lineRenderer.positionCount; i++)
{
x += i * 0.001f;
y = amplitude * Mathf.Sin(k * x);
lineRenderer.SetPosition(i, new Vector3(x, y, 0) + startPoint);
}
}
// Update is called once per frame
void Update()
{
}
}
Итог который пытаюсь получить:
Подскажите , где допустил ошибку, благодарю.