Reduce collision hit between objects - unity3d

I am using rigidbody on my object but the when the collision occurs between two objects, it flies off. I want the collision to be minimum. What should I change in my rigidbody settings?

In the collider component add a physics material and in the physics material scriptable object change the bounciness and the same for your other object with which it is colliding.

Related

Simple problem on Unity 2D with empty object collider

I want to make one empty object that player can pass but enemy can't pass.
I have added collider to the object. so I can see triggering of collider event with object and player, enemy.
But both are passing the object. Only I need player passing.
What I should add?
Navigate to the Unity Physics 2D settings (Edit>project settings) and then scroll down and uncheck the unwanted colliders that u don’t want to collide with each other.
Make sure to give the player, the object collider and the enemy a unique layer.
Uncheck the layer between the player and the object collider layer hence will allow the player only to pass.
You have multiple options.
One of them is using Layers and the Physics2D -> Layer Collision Matrix. Here you can define which layers shall be interacting with each other and which should ignore each other.
See also Layer-based Collision.
So e.g. have three layers
Player
Enemy
Goal
and make the collision matrix to allow collision between Enemy and Goal but ignore collision between Player and Goal. Then make all colliders isTrigger = false.
=> Only the object(s) with the layer Player can pass the object(s) on the layer Goal while the object(s) with layer Enemy will collide with them, thus can not pass them.
This can only be set up beforehand. You can however still make objects dynamically switch layers and thereby even on runtime control which objects can collide with each others.
As alternative you can also make collisions between specific individual colliders be ignored by using Physics2D.IgnoreCollision
Makes the collision detection system ignore all collisions/triggers between collider1 and collider2.
Using this you can dynamically enable and disable collisions between specific colliders.
But if you actually want to be able to have an event be triggered by both player and enemy but the enemy shall not be able to pass the goal then your setup should probably be like
Goal isTrigger = false
Enemy isTrigger = false
Player isTrigger = true
this way the player will pass the goal, the enemy won't.
Then you would use both OnTriggerEnter2D to detect the player collision and OnCollisionEnter2D to detect the enemy collision.

How do I make GameObjects use physics to interact with each other using Vuforia?

I'm using Vuforia for an AR school project and am trying to make a Roll a Ball game. However, the ball keeps falling through the ground despite the fact that both the ground and the ball have colliders. How can I the ball interact with the ground?
In general you always need at least one Rigidbody in order to get collisions via the physics engine.
A Rigidbody
is the main component that enables physical behaviour for a GameObject
What you would probably use for that is a kinematic Rigidbody on your moved object.
This is a GameObject with a Collider and a kinematic Rigidbody attached (ie, the IsKinematic property of the Rigidbody is enabled). You can move a kinematic rigidbody object from a script by modifying its Transform Component
but it will not respond to collisions and forces like a non-kinematic rigidbody. Kinematic rigidbodies should be used for colliders that can be moved or disabled/enabled occasionally but that should otherwise behave like static colliders. An example of this is a sliding door that should normally act as an immovable physical obstacle but can be opened when necessary. Unlike a static collider, a moving kinematic rigidbody will apply friction to other objects and will “wake up” other rigidbodies when they make contact.
Even when immobile, kinematic rigidbody colliders have different behavior to static colliders. For example, if the collider is set to as a trigger then you also need to add a rigidbody to it in order to receive trigger events in your script. If you don’t want the trigger to fall under gravity or otherwise be affected by physics then you can set the IsKinematic property on its rigidbody.
For detailed information also refer to Unity Manual - Colliders and in particular the sections Collider Interactions and Collision action matrix

Unity: 2d GameObject Ricochet

How can I make a 2D GameObject Ricochet off a wall or surface with the same angle it used to hit it? Can you just point me to the right direction or how I should do it?
Create your bouncing game object as a sprite. Add a 2D collider component and a rigidbody2D component. Add a physics material into the material property of the rigidbody and adjust settings to taste. Your object should move with physics and bounce off things when it collides with them.

Unity2D - Level with invisible collisions

In my Unity2D project I want that to load a level as a sprite from my resources. The game is a top down view. I then want to add invisible collision boxes where the walls in the level-image are.
How would I do that?
I have attached a box collider to my player and now? Creating an empty game object with another box collider doesnt work.
See #Savlon comment, you need rigidbody with your collider component as well for empty objects. And they will provide blocking of player object if you player object also have collider and rigidbody. Don't mark your colliders as trigger and ensure they are on the same layers.

Collision detection, without the physics?

I have enemies following a path in my game. Along the path I have turrets shooting at them. To get collision detection between the bullet of the turret and enemy i've added RigidBody2D, and Circle Collider 2D to the enemy, and Circle Collider 2D to the bullet.
When the bullet hits the enemy it shall not push the object, just destroy the bullet and take some of the health.
I feel Rigidbody2D is messing it up, it gives mass, drag and gravity to my enemy... but I dont need it. But it seems I do if I want to have collision detection bewteen two objects?
You need Rigidbody to detect collisions, however you are just triggering some actions (taking damage). That is why you can check isTrigger on your colliders, and then implement 'OnTriggerEnter2D' callback instead of 'OnCollisionEnter2D', which won't activate any physics.
See http://docs.unity3d.com/Documentation/ScriptReference/Collider2D.OnTriggerEnter2D.html for reference.