kaiyumcg / UTProjectile

A projectile control and projectile movement(transform) for unity engine powered games

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Projectile control and movement scripts for unity powered games. Currently only transform based movement is supported. Uses DOTS for snapping features.

Installation:

Install Burst and Job from package manager. Copy the “ProjectileMovement” folder inside your unity project.

Usage:

    [SerializeField] ProjectileControl control;
    [SerializeField] Transform ballPrefab;
    [SerializeField] float speed = 20f;
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            control.StartPlayerInput((points) =>
            {
                var ball = Instantiate(ballPrefab) as Transform;
                control.TravelAlongProjectilePath(ball, speed, points,       isLooping : false, () =>
                {
                    Debug.Log("Reached");
                });
            });
        }
    }

This will start the control script as well as show projectile in line renderer or in a custom way. At the release of control(when mouse button/touch is up), a prefab will move along the trajectory. Configure the “ProjectileControl” component in the inspector to your liking.

Check the ext.cs file for some handy extension methods as well.

About

A projectile control and projectile movement(transform) for unity engine powered games

License:MIT License


Languages

Language:C# 100.0%