Animating Object in unity are change the position of another object - unity3d

I have created an animation where the character is holding the gun.m
This is what my hierarchy
Player
-Camera Holder
---Camera
-Collider
---Arms
-----WeaponHolder
-------LHNode
-------RHNode
-------GunHolder
---------(The Instantiated Gun)
When setting the gun I use the left and right nodes to position the arms. I animated the person living the gun up but I so far haven’t animated the gun or the gun holder. It’s not even a component appearing in the unity animation system but whenever I play the game it resets any transforms that have been applied to the gunholder. Anyone know how to help??
Hopefully that all makes sense. Thanks

Related

How to make an object follow the movements of an animated object in Unity?

So I've animated my spaceship. With it's previous rigid form I've got a particle system coming out of it's wings. Now that it's animated, I still want those particles to follow all of it's wings movements, but the particles don't move along with the animations, even being parented with the gameobject's wings, showcase video, 19seconds: https://youtu.be/XJNjT4s4X6I
How can I make those particles move along with it's wings movements? Thanks
I would try to parent them with the bone of the armature, I don't remember if it worked for me though, but what I did is to add an empty in the modeling program to follow the animation and export it, so I can parent it to the things I needed, for you It would be the Particle System.

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)).

How to add an gameobject to an animated rig properly

I have moddeled and rigged an human in blender and I am able to play that animation in unity.
Now I am trying to add some objects to the human. For example an hat. But I cannot figure out, how it is made that the hat moves withe the animation.
I know, that the head has got the animation data. The hat does those data not have, hence the hat does not move.
How do I do this? Another scenario would be grapping sth. with the hand and that object should move together with the hand movement.
I would like to add those objects via script later on.
Thank you very much :)
In your character's rig in the unity scene,
Find the Bone that you want your target GameObject to follow, and add the target GameObject as a child of the bone GameObject in the Scene heirarchy, and position it with whatever position and rotation offset you need (In this case, on the head bone, maybe a little tipped)
In this case, you would find the Head bone of your rig, and add the Hat as a child gameobject of the head bone. Any animation you play, which modifies the bone positions should also move your target GameObject.

Unity Oculus - Rotating empty parent on character rotates on a weird axis when player isn't standing at origin

Sorry I know the title is really confusing.
Basically the camera and hands are nested under an empty object. This empty object is then used to rotate the character and teleport the character. Thing is, the camera is able to freely move around and away the empty object. Making rotation seem like you're running in a circle instead of just rotating. Then when you teleport it's a little offset. Like if you shoot the teleport beam straight down you move because it's teleporting the empty object to the camera which moves the camera.
So if the headset and camera aren't exactly on top of the empty object everything gets wonky. I understand the problem just can't figure out a solution.
I tried resetting the position on every teleport but you can still move away and spin in circles. As well as resetting resets the orientation and that's not exactly what I need.
Any help would be greatly appreciated.
There's a few ways to approach this. A crude, and not very elegant solution would be to parent your camera parent to yet another object, created in runtime, that would assume the position of the actual player camera when the rotation starts. You can reparent objects dynamically, so you could rotate this newly spawned object, which would give you the desired effect, and then loose the top parent when the rotation stops.
Alternatively you could move your camera parent as you rotate it, based on transforming the position relative to the player camera position. A bit more elegant but there's probably a few lines of math that you would have to write

Controller / player does not rotate when jump on rock

I have one eliptical shape rock which is rotating around own center and I want to jump on that rock.
When I jump my player / controller does not rotate together with that rock. I have capsule colider on my rock but checkbox Is Trigger is not checked.
When I checked it is just pass through rock. Hot to make that controller / player when jump on rock rotate together with rock ?
I must say I didnt find any solution using only physics.
Unity3D physics engine dosnt support this kind of rotating (to my knowladge). First I thought it is becouse of shape of player's collider (capsule) couse it has only one point that is touching other collider (the one that is rotating). But I checked also with box collider and the object (player) didnt rotate too.
So you will not get this just with physics.
There was an answer here but was deleted with solution. This solution was to assign parent to player gameObject. This parent will be this rotating object (rock). Thanks to this player object will recive all movement from rock.
You should assign the rock as parent to player when collision is detected. OnCollisionEnter(Collision)
player.transfrom.parent = rock.transform;
And set the parent of player to null when player leaves the collistion. OnCollisionExit(Collision)
player.transfrom.parent = null;