Controller / player does not rotate when jump on rock - unity3d

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;

Related

Unity rigidbody always falling when on another rigidbody. (Unity 2D)

I'm relatively new to Unity, I have a player character and a box sprite, I want the box to be movable by the player and for it to fall, so I gave the box a box collider 2D and a rigidbody2D, the box moves fine and the player can move it OK, however whenever the player is touching the box in any way (standing on it or pushing it) the characters Y velocity begins fluctuating uncontrollably making it play the falling animation. Through some testing I found the problem was the player's rigidbody and boxes rigidbody interaction, I don't know how to fix it. Any help would be great thanks
I think u just need to set both the player character and box sprite 's rigidbody2D to dynamic with 1 gravity scale... u can change their mass to manipulate the motion...

Animating Object in unity are change the position of another object

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

How to prevent from the player to slide down a bit on the terrain?

I want at this point that the player will stay and will not slide down because the player get interaction with the box and when he move a bit to the side he lost interaction.
I don't want to disable the player movements controls or to make the Rigidbody of the player Is Kinematic true because i want that the user will be able to move to the player but if the player is not moving the player the player should stay and not sliding down a bit.
This is a screenshot of the player components settings :
The player collider material settings :
And last the terrain collider material settings :
You could only activate Is kinematic when it is standing still. When it starts moving again you can turn it off.
If you don't want to use it, there are other options: change the material when it stops, assigning one to the player with the highest Dynamic and Static Friction settings; activate Freeze Position in the Rigidbody; Make the player static; record the position as it stops and assign it to transform.position for each frame in the Update() method; increase the mass by a lot..
If I was helpful, you can thank me by marking this answer as accepted :)

Unity Camera Bounces with Sphere Animation when trying to apply gravity with Rigidbody

I have an empty Object that has, among other things, a third and first person camera, and a sphere with a bouncing animation attached to it. I'm try to get it so that the sphere experiences gravity, but I'm having a lot of problems.
What I want is gravity on my sphere and the camera to not bounce with the ball.
Here a couple scenarios I've tried, and their outcomes:
1) When I attach a rigid body to the the Sphere (child of the empty Object) with apply root motion true or false, my character experiences no gravity. The ball bounces, but the camera follows the ball without bouncing with the ball. It also follows if i press the space button (to jump) The whole problem is i need gravity to fall back down when i jump. Right now i just go up.
2) When I attach a rigid body to the empty object (the parent), I gain gravity, but now my camera bounces with the ball, and if the ball tumbles and rotates, the camera rotates with it.
Is there a way to get the best of both worlds?
i.e: Ball experiences gravity, but the camera does not. The camera simply follows around the ball from first or third person view without bouncing.
Thanks so much
For me, I would like to create a Vector3D variable to record the offset between the ball and the camera. And you simply add the offset to your camera each time so your camera can chase the ball without bouncing with it.
For example:
Vector3D offset = cameraPos - ballPos;
//...
CameraPos = ballPos + offset;
If you don't want the camera moving with ball's gravity, you can block the change of Y axis.

Capsule Collider doesn't move smoothly

I have some issues using CapsuleCollider and RigidBodyController in a Player GameObject in Unity.
Using a CapsuleCollider as collider for the player, I noticed that the player doesn't move like a capsule or a sphere (in other words, I want that the movement should be like a rolling ball, with no stuttering), but its movements like more like a box pushed, with stops and starts, that make some little oscillations of the camera.
Any ideas, solutions or tips?
realy that is all based on how your moving the object, and the rigidbody2D settings of the object, I think using physics forces would roll your character like a ball or capsule, however just setting a velocity wont.