Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Assembly and Dissassembly System?

Discussion in 'Scripting' started by OverBoozt, Jul 1, 2020.

  1. OverBoozt

    OverBoozt

    Joined:
    Jul 1, 2020
    Posts:
    2
    Hello! I just downloaded unity, and i'm working on a small game.

    The game is about building car engines.

    I have made a working first person view player that has lifting and throwing cababilities.

    What im looking for tough is how to make the Cursor on the center of the screen turn into a Checkmarker when it collides with the right spot to place the item. When the checkmark appears i want to be able to press for instance "F" to mount the part, meaning it jumps into the position of the engine as it would in real life. I have found a game that has these capabilites. The game is called My Summer Car, where you build up a running car from a old shell and some parts in your garage, and thats the kind of mounting system im looking for. I have all models and seperated parts done, just not the coding.

    I have been searching alot and i'm yet to find any tutorials, or forums talking about this.
    Any kind of help will be appriciated!

    Here is a video of My Summer Car:
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,947
    Look up "Raycasting from mouse position in Unity". Essentially you'll do a raycast into the game world from the cursor position, and if you hit the "correct" piece, you can put your code to change the cursor and respond to the player input to place an object.
     
  3. OverBoozt

    OverBoozt

    Joined:
    Jul 1, 2020
    Posts:
    2
    Thanks! I will look into it tomorrow!
    Appriciate it.
     
  4. SonOfDurdun

    SonOfDurdun

    Joined:
    Sep 23, 2021
    Posts:
    1
    Hi I am someone who is working on a game inspired by my summer car, now I am going to be honest I haven’t looked up Raycasting from mouse position in Unity but I was just wonder if I could use a hitbox and a line of code like
    “if var playerholditem = true
    Wheelmount = ture” and so on.
     
  5. Arsenich

    Arsenich

    Joined:
    May 8, 2022
    Posts:
    1
    I am also working on a similar game, and it works like this for me: we have a car with all the customized parts, then we make their duplicates with Rigidbody, and we turn off the customized parts and create triggers in their place.
    Since I work with PlayMaker, the scheme is as follows: we create a Raycast beam, then we create a condition - if the beam touches the trigger, then we can press a key, and the part with the Rigdbody turns off, and the configured part turns on.
     
  6. goosiewoosie

    goosiewoosie

    Joined:
    May 17, 2024
    Posts:
    1
    Has anyone found a solution? I’m trying to make a game like my summer car aswell.