Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

War Thunder aiming system

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

  1. Zenden1

    Zenden1

    Joined:
    May 20, 2017
    Posts:
    36
    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. Zenden1

    Zenden1

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

    AndersMalmgren

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

    Zenden1

    Joined:
    May 20, 2017
    Posts:
    36
    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:
    3,619
  6. Zenden1

    Zenden1

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

    AndersMalmgren

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