Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

War Thunder aiming system

Discussion in 'Scripting' started by Zenden944, Sep 16, 2018.

  1. Zenden944

    Zenden944

    Joined:
    May 20, 2017
    Posts:
    9
    Hello, i want to make a aiming system like war thunder.

    I search to make system who cursor is overlaping

    Like this vidéo :


    I already make a script for rotation but i don't now how make cursor system.

    Code (CSharp):
    1. ector3 direction = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z) - transform.position);
    2.  
    3.             Quaternion rotation = Quaternion.LookRotation(direction);
    4.  
    5.  
    6.             transform.rotation = Quaternion.Lerp(transform.rotation, rotation, shipTurnSpeed * Time.deltaTime);
     
  2. Zenden944

    Zenden944

    Joined:
    May 20, 2017
    Posts:
    9
  3. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    2,856
    The outer ring is were you wanna go and the inner one syncs to the actual plane. Nothing fancy going on
     
  4. Zenden944

    Zenden944

    Joined:
    May 20, 2017
    Posts:
    9
    For me, is more easy to say as to do. How i can do that, i don't understand
     
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    2,856
  6. Zenden944

    Zenden944

    Joined:
    May 20, 2017
    Posts:
    9
    I have to set the two cursor in UI ? Or in a gameobject forward the plane ?
     
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    2,856
    You use world cordinates and translate them into screenspace and place the UI elements correctly