- Home /
How to make a custom arc
this is not a question but a script that i wanted to share with you here is the example: https://youtu.be/V-pwNscZams
and here is the script:
using System.Collections.Generic;
using UnityEngine;
public class ARK : MonoBehaviour
{
public Transform Target;
public GameObject middel;//this is just a cube prefab
public float multplier;
public List<GameObject> shape = new List<GameObject>();
public float Max = 10;
public AnimationCurve curve;
void Start()
{
Vector3 senter = (transform.position + Target.position ) / 2;
for (float i = 0; i < Max; i++)
{
GameObject Boxes = Instantiate(middel,transform.position , Quaternion.identity);
Boxes.transform.SetParent(transform);
shape.Add(Boxes);
}
}
void Update ()
{
for (float i = 0; i < shape.Count; i++)
{
Vector3 pos = transform.position + (Target.position - transform.position) * (i / Max);
shape[(int)i].transform.position = pos + ( ( transform.up * (curve.Evaluate(i / Max)) * multplier));
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Voxel Engine Coding Blocks? 0 Answers
Custom Inspector, duplicates variables ? 1 Answer
Instantiate cube on network 0 Answers