Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Move object by snapping it to the mouse cursor

Discussion in 'Scripting' started by Magimi, Feb 11, 2020.

  1. Magimi

    Magimi

    Joined:
    Jun 5, 2019
    Posts:
    2
    Hi guys,

    So basically I'm making home decor app and I need "sims-like" objects movement. I just need to snap an active object to the mouse and move it along X and Y axis untill I hit escape key. I've been searching for script like this for weeks....

    Thank you!
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @Magimi

    "I've been searching for script like this for weeks...."

    And you might be searching for a good while - no one makes tailor made scripts for your use... so better figure it out yourself.

    Try converting your screen position to a Plane position, or raycast to some floor object to get a world position.
     
  3. PaulR

    PaulR

    Joined:
    Nov 14, 2012
    Posts:
    43
    eses likes this.
  4. Magimi

    Magimi

    Joined:
    Jun 5, 2019
    Posts:
    2
    I know unfortunately, but I'm not a programmer (I'm more into 3d modelling) and I just need basic app to show my models :(
     
  5. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @Magimi

    Well - I'm pretty much in the same boat - but if you don't want to start learning how to code (like in 2 weeks you could have learned some basics of C# and Unity specific things), maybe get someone to do the coding for you or see if Asset Store has some asset you could use.

    If you need basic viewer - why not use Marmoset or Sketchfab?