Unity Player Collider does not work properly - c#

I have not worked with unity in a while so I am a little rusty.
I have:
Game Object with a mesh Collider which is my ground
A Empty Game Object with a Character Controller Which holds my player game objects
My Empty Game Object that holds a player doesnt not stand on top of the ground.
So half my player is going through the ground but the Empty Game Object stays ontop of the ground which holds my character.

Possible problem with pivot of 3d model(Character)
With your current heirarchy structure: One possible solution is to make Center:y = -1.8 in the character controller component.
Let me know if it helps.

Related

Unity Character controller bouncing

I have a game object with a Character controller. I set it up to move and jump. Everything works fine, but when I add an Animator, the object bounces once after landing on some other object that contains the box collider.
I have already tried many ways, but they did not lead to a positive result. I tried to edit the fbx model, change the anchor point, change the position of the Character controller on the object.
When I removed the animator, the problem disappeared, but I need to use movement animation. And for some reason it affects gravity. Without it, the player's game object jumps higher. I've been working in Unity not so long ago and I don't remember how to solve this problem.
If you are using the RigidBody component, you may need to make a physics material for your player. The physics material defines some properties of the object such as how much it bounces. In the Assets folder: click create > physic material
This will create a physics material. Edit the bounciness and add it to the RigidBody of your character.

any reasons why my instansiated enemies prefabs don't appear in the camera game view even it apears in the scene view

I've got a really creepy issue, I am following a tutorial where making a monster chase game and instantiating enemies from the left and right side using an empty gameObject called Spawner got a script with an array that carries my monsters prefab to spawn randomly from the but unfortunately, the spawned monsters appear in the scene view but not in the camera view
here are some images that explain more
regards,
Check if your Z value is within your Camera's clipping plane.
actually, i changed the camera position from -10 to -50 and then the enemy showed in the game view

How to detect collisions for a rotating child object in Unity3D C#?

I am making a First Person Shooter and I have a rigged player with a mouse look script, and I used to rotate the spine with spine.transform.rotation, but this method does not look for collisions, this means if I rotate and I am standing near to a GameObject, I glitch/bug through the object. So I tried to do it with a Rigidbody but this doesn't seem to work, I tried: rbSpine.AddTorque(new Vector3(mouseLook.y,0,0), ForceMode.Force);. This doesn't do anything. And I have another problem with the Rigidbody, I've only a rigidbody attached to the spine, my player has multiple simple collision and these overlap eachother a little, and my rigidbody is pushed away into the air slowly. Does anyone know a solution for this?
I put a rigidbody component on the player, this will take care of the collision detection for itself and all its child objects.

Unity: Make object appear or disappear randomly during game play

I'm creating a 3D, 1st person maze game in Unity. The objective of the game is to reach the other side of the maze before time is up. To make the game fun, for every round a player starts the maze map randomly generates walls so every maze is unique so the player can't memorize a path. I've decided what I should do is create a grid of walls like this...
(Imagine that the lines are the walls, each segment is an individual wall object)
When a player starts, each wall segment will have a chance of disappearing, so imagine that this grid will transform into something like this...
How do I do that? I will be using C#. Basically, I want to wall to turn invisible and be passable if it is selected to "disappear". The algorithm will be
game starts
probability that wall will disappear = 1/3;
wall disappears = true;
if(true){
wall becomes invisible and passable
}
else{
wall stays there
}
There are many ways to make an Object disappear in Unity.
The wall to make disappear:
public GameObject wallObject;
1.Deactive it
wallObject.SetActive(false);
2.Disable the Renderer component of the Wall then the collider so that other GameObjects can pass through it
wallObject.GetComponent<Renderer>().enabled = false;
wallObject.GetComponent<Collider>().enabled = false;
3.Destroy it.
Destroy(wallObject);
You can use Random.Range to generate the number number then use one of the method above to hide that wall.

unity: fix Player passing through objects

After updating from unity 5.5.2 to 2017.3 the Player character does not collide with objects(evironment asset) and is passing through them, all the objects have mesh collider with convex on, This is only happening in one of the level(scene) in the game while in rest of the level(scene) the player behaves normal and is colliding with objects.
Player settings
object settings
The player's rigidbody is kinematic. I would try by disabling that property.

Categories