Search Unity

Interactive 3d model Assembly/Disassembly

Discussion in 'Scripting' started by vency24, Feb 10, 2016.

  1. vency24

    vency24

    Joined:
    Jan 21, 2016
    Posts:
    2
    PTPA.

    Hello everyone.. I'm newbie here. I need any suggestions about my project titled "3D model Assembly/Disassembly".
    I have problem about the functions of my Model..

    Let me explain briefly.

    Example i have 3D model of GUN which has dragging and dropping functions to assemble and dissemble by parts..
    Now i have difficulties about the validations of my model if it is in the proper location or not?
    And also how my object snap on their exact positions.. I've tried to program if/else statement about the exact positioning of my object.. my logic is. "when my object dragging near in the right position it will be automatically dropped in the exact position using value of position x,y and z.. But it accepts floats value not decimal so that it gave me an error.. Please help me.. Thank you so much.

    This link as video example:
    (Disregard the leap motion)
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    where are you getting decimal datatypes from? o_O

    without seeing your code it's going to be hard for anyone to give specific advice
     
  3. vency24

    vency24

    Joined:
    Jan 21, 2016
    Posts:
    2
    I'am beginner in unity 3D..

    First i get the ORIGINAL position(x,y,z) of my object with the value of X = -0.0603511, Y = -3.823358 and Z = -2.56258.

    Then the logic is when my object is dragging nearby ORIGINAL position it will be dropped .

    Here's my code..
    if (gameObject.tag == "Barrel") {
    if (gameObject.transform.position.z <= -2.56258 && gameObject.transform.position.z >= -1.015973 || gameObject.transform.position.x <= -0.603511 && gameObject.transform.position.x >= -0.2236678 || gameObject.transform.position.y <= 4.785321 && gameObject.transform.position.y >= -0.2236678) {

    this.transform.position = new Vector3(0.603511,3.832358,-2.56258);(<-- This line gave me an errors)
    ! error CS1502: The best overload method match for 'UnityEngine.Vector3.Vector3(float,float,float) has some invalid arguments

    !error CS1503: argument '#1' cannot convert 'double' expression to type 'float'


    }

    }
     
    Last edited: Feb 11, 2016