本文整理汇总了C#中UnityEngine.LineRenderer.SetPositions方法的典型用法代码示例。如果您正苦于以下问题:C# LineRenderer.SetPositions方法的具体用法?C# LineRenderer.SetPositions怎么用?C# LineRenderer.SetPositions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.LineRenderer
的用法示例。
在下文中一共展示了LineRenderer.SetPositions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
GameObject lockedCrosshairImage = new GameObject();
Image crossHairImage = lockedCrosshairImage.AddComponent<Image>();
crossHairImage.rectTransform.pivot = new Vector2(0.5f,0.5f);
crossHairImage.rectTransform.anchorMax = Vector2.zero;
crossHairImage.rectTransform.anchorMin = Vector2.zero;
crossHairImage.rectTransform.sizeDelta = new Vector2(64,64);
crossHairImage.raycastTarget = false;
crossHairImage.sprite = trackingCrosshair;
crossHairImage.color = Color.black;
crossHairImage.type = Image.Type.Filled;
crossHairImage.fillMethod = Image.FillMethod.Radial360;
crossHairImage.fillAmount = 0;
//TODO get reference to the correct canvas
Canvas canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
crossHairImage.transform.SetParent(canvas.transform);
crossHairImage.transform.SetAsFirstSibling();
crossHairImage.transform.localScale = Vector3.one;
myTrackingCrosshair = crossHairImage;
myTargetingLine = myTrackingModule.gameObject.AddComponent<LineRenderer>();
myTargetingLine.useWorldSpace = true;
myTargetingLine.SetVertexCount(2);
myTargetingLine.SetPositions(new Vector3[]{Vector3.zero,Vector3.zero});
myTargetingLine.SetWidth(0.5f,0.5f);
myTargetingLine.SetColors(Color.red,Color.red);
myTargetingLine.enabled = false;
}
示例2: RenderGesture
public void RenderGesture(Gesture nextGesture)
{
if (currentGestureLineRenderer != null) Destroy(currentGestureLineRenderer.gameObject);
currentGestureLineRenderer = Instantiate(gestureOnScreenPrefab).GetComponent<LineRenderer>();
Vector3[] rendererPoints = nextGesture.Points
.Select(gesturePoint => new Vector3(gesturePoint.X, -gesturePoint.Y, 0))
.ToArray();
currentGestureLineRenderer.SetVertexCount(rendererPoints.Length);
currentGestureLineRenderer.SetPositions(rendererPoints);
StartCoroutine("TransformGesture");
}
示例3: MakeLine
void MakeLine()
{
GameObject go = new GameObject();
lineRenderer = go.AddComponent<LineRenderer>();
lineRenderer.SetVertexCount(3);
Vector3[] positions = new Vector3[3];
positions[0] = Vector3.one + offset;
positions[1] = positions[0] + Vector3.one;
positions[2] = positions[1] + Vector3.one;
lineRenderer.SetPositions(positions);
lineRenderer.useWorldSpace = false;
offset += Vector3.one;
go.transform.SetParent(gameObject.transform);
}
示例4: Start
// Use this for initialization
void Start()
{
lr = GetComponent<LineRenderer>();
//lr.SetPosition(0, go1.transform.position);
//lr.SetPosition(1, go2.transform.position);
var positions = new Vector3[3] {
go1.transform.position,
go2.transform.position,
go3.transform.position
};
lr.SetPositions(positions);
}
示例5: Start
public void Start()
{
line = GetComponent<LineRenderer>();
line.SetPositions(new Vector3[transform.childCount + 1]);
}
示例6: Start
// Use this for initialization
void Start()
{
MiMi = GameObject.FindWithTag("MiMi");
lr = gameObject.AddComponent<LineRenderer>();
lr.material = new Material(shader2);
lr.material.color = new Color(0f, 1f, 0f, 0.05f);
lr.SetWidth(0.5f, 0.5f);
Vector3[] points = { gameObject.transform.position + new Vector3(0.0f, 0.0f, 0.0f), WireAnchor.transform.position + new Vector3(0.0f, 0.0f, 0.0f) };
lr.SetPositions(points);
canAttach = false;
attached = false;
}
示例7: SetUpTargetingReticle
/// <summary>
/// Creates the vertices for the targeting laser
/// </summary>
private void SetUpTargetingReticle()
{
reticle = gameObject.GetComponentInChildren<LineRenderer>();
//reticle.SetVertexCount(100);
Vector3[] positions = new Vector3[100];
for (int i = 0; i < positions.Length; i++)
{
positions[i].x = 0;
float t = i * .25f;
t = t * t;
positions[i].y = -.5f * 9.81f * t;
positions[i].z = i * 50 * .25f;
}
reticle.SetPositions(positions);
}
示例8: SetupLineRenderer
// Initialisiert die LineRenderer Komponente
void SetupLineRenderer()
{
lineRenderer = this.GetComponent<LineRenderer>();
lineRendererVertices = new Vector3[lineRendererVertexCount];
lineRenderer.material = lineMaterial;
lineRenderer.SetVertexCount(lineRendererVertexCount);
AlignVerticesInCircle(transform.position, ref lineRendererVertices);
lineRenderer.SetPositions(lineRendererVertices);
}