unity: fix Player passing through objects - c#

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.

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.

How to destroy the single colliding object?

Hope you're well. I've been trying to make it so when the bullet collides with the enemy, the enemy dies using the Destory(gameObject); function.
Yet, when it destroys the gameObject, this prevents the enemies from spawning as the spawner cannot find the gameObject.
So, I'd need to make it so Destory(gameObject); only destroys a single enemy bullet hits, not the full gameObject.
your mistake is you are destroying the referenced object, and your other script wants to call it.
do not use a scene object as reference object. make it a prefab, and than drag that prefab on object with script. it will solve your problem.

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.

Multiple Colliders - How to make a collider invisible to certain objects

Basically I have teleport zones set up to access new areas within the level. This is only supposed to respond to the player's box collider. However, I attached a cube to the player, disabled the mesh render and use its collider to detect enemies. Unfortunately, the detect enemy collider touches the teleport zone and warps me to the new position well before my player gets near it. I tried to change the tag on the enemy detection collider but it still teleports.
How do I go about making the teleport object ignore the player's enemy detection collider?
I'm using Unity 5.3.8 and C#
Change player's GameObject layer to Player. Then, create a new layer called Teleports. Go to Edit -> Project Settings -> Physics. Then, under Layer Collision Matrix, in Teleports row uncheck everything except for column under Player.
Now, objects in Teleports layer will only collide with objects in Player player.

Unity 2D collisions not being detected

I have been following the Unity 2D rougelike tutorials. The inspector returns no console errors when run.
The player moves on a grid and should collide with objects, some should trigger upon moving over them and others should prevent movement, the objects that activate upon trigger work as intended. The player has a Rigidbody 2D and Box Collider 2D and is set to is kinematic. The objects that do not work as intended are the walls, the outer walls should block movement entirely, the inner walls should be breakable and the enemies can not be damaged or damage the player. The walls all have a Box Collider 2D. The enemies also have a Rigidbody 2D and is set to is kinematic Game
It's normal that the walls don't block your player. You have set the isKinematic to true. What that does is
Controls whether physics affects the rigidbody.
So when you set it to true, physics no longer affect your player and he will not collide with anything.
From the Unity documentation:
If isKinematic is enabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position.
You should set the isKinematic to false if you want your player to be able to colllide with different objects.

Categories