Move multiple child objects with parent in Unity + LeanTouch - unity3d

I am facing some issues using LeanTouch asset.
Context:
I am creating a Human Anatomy application using Unity3D and Vuforia. My task here is to enable user to select, drag, move human skeleton and different organs to inspect them. I was able to achieve this as long as my GameObject does not have any parent.
For example, I have a Heart 3D model having 3 child gameobjects. If i use leantouch's selectable and other drag translate. It works with no issues. But as soon as i apply the same components to the parent Heart Object. It does not work.
If you want to try it out. Create 2 or 3 3D cube objects in unity. Then create an empty gameobject and place 3d cubes into it. Now try to add lean touch components to the parent gameobject. It won't work.
Thanks

Related

Player keeps gettings stuck on game object in 2D tile based scene

I am creating a 2D grid based game in Unity. I am using Tile maps for background (one grid and two tile maps).
On the first tile map I have the background (like grass) and on the second one I have things I add, like a hole in the ground. Now I add game objects to the scene (a sprite tree). I have two BoxCollider2D on the tree, first one is just a small one at the bottom of the tree and the other one covers the whole tree but is set as trigger (I have a script that automatically fades out the tree when user is behind it).
The problem is that the user keeps getting stuck at the collider (I think) at the bottom of the tree. It works from some angles. I tried creating a small 2D square too and sometimes I get stuck to that too. What am I missing?
I have added a custom material that has friction set to 0 on both the Player and the tree.
I don't know if it is relevant but the tree is quite big so I had to set its size to 0.5 instead of 1.
remove the interaction between the player and the tree, see in project setting, modify the script to work with a raycast
or just make the tree collider a Trigger..

How can I remove small part of collider of game object in unity 2d

click here for gif show of what I want
I want to remove mesh of object when user click on object and also remove its collider to make another object fall from that removed mesh area...
I am using unity since last month so I don't have much experience and knowledge, please help me...
Creating the destructable ground particles
One way to achieve whats shown in the gif is by creating a prefab of e.g. a circle collider that is instantiated in the area of where the dirt is in your gif. It acts as a "ground particle" and keeps the objects above itself.
You instantiate a lot of them in the area so it acts as a big collider although it is actually a whole array of smaller colliders.
Implementing the interaction logic and deactivating the ground particles
Ater that you implement the functionality of dragging the mouse over the ground particles, removing them. That is also not difficult. Shoot raycasts into the screen at the postition of the mouse (remember to use Camera.ScreenToWorldPoint) and get the collision information (confer to https://docs.unity3d.com/ScriptReference/Collider2D.Raycast.html). With the collision information you can get the reference to the instance of your ground particle(raycasthit.other.gameobject) which is then disabled through script(gameobject.setActive(false)).

Unity 2d: Interactable tiles

I want to create a 2d game with tiles that are interactable, i.e farmland, trees, breakable rocks, etc.
Now if I create my tilemap in Tiled which I have done so far, it does not offer that type of control.
I found some posts on how to deal with this but they are at least 3 years old, so wondering if there is some updated answer? maybe something built in to Unity or a plugin I'm not aware of to help create Tilemaps inside Unity?
I want, for example, 1 tile of grass to be able to react if I hit it with a hoe, or water, and change to dirt. Is my only option to create prefabs and place every tile as its own gameobject? won't that kill performance in a large world?
You could try exporting your Tiled tilemap to .tmx format, creating a script in Unity that loads .tmx files for your map and reads every single tile in a for loop.
You would need to assign a prefab to each tile ID of your tilemap, and in that prefab you could have your script with logic attached (grass reacting to a hoe/water) and graphics.
Other idea is to export one big image of your map, and then export .tmx format in the same way as explained before but create game objects only for ID's that player can interact with and only attach scripts to them.

Combine two sprites into prefab Unity

I have two sprites I downloaded off the asset store on my canvas one is a building, one is the foundation the building sits on.
However, in my game these two sprites will always be together. I'm going to be creating many instances of these on my map and I don't want to have to drag each piece on to the map individually and position them. So I was hoping to highlight them both and turn them into a prefab so Id just have to manage one object instead of dragging around both sprites.
I could just open them in photoshop and combine the two images but I'd prefer to just put them together in unity and leave my sprites modular.
You can create a empty object. This object is parent object.
Then in hierarchy window, you drag 2 sprite to this parent object. So 2 sprites is child of parent object. Make this parent object as prefab.

Clickable and Rotatable models using Unity and ARToolkit

Can the 3D models used with the markers be made clickable and rotate able using Unity3D engine and ARToolkit unity. Basically in the AR desktop application we are making , we want to implement this functionality on the 3D models as well. Kindly need help in this matter. ThankYou.
The only issue you could find is that the Transformation of the AR Tracked Object changes based on the visual information.
If you simply use that as a base object and put any other models as children of that one, you can modify their position and rotation in the same way you would do for any other situation.
So, as you see, the Marker scene has nothing but an AR Tracked Object, this is the object that will be updated with the pose of the marker.
Then, the Cube is a child of this object. If you modify the localPosition or localRotation of the cube it will work as you want it.
The Cube is a child of the Marker scene, its global position and rotation will be a combination of the position and rotation of its parent with its local position and rotation (this is standard 3DEngine / SceneGraph behaviour).