I’m using the input of the mouse to throw around a gameobject (player) which collides with other gameobjects (enemy).
Sometimes when there is a collision the enemies fly upwards.
I’ve tried increasing the mass of the enemies but thats not helping.
i’m using the following line to add an Impulse force to the player (the moving of the mouse is the input)
rigidbody.AddForce(new Vector3(input.x * multiplier, multiplier / 3, input.y * multiplier), ForceMode.Impulse);
any ideas why the enemies get thrown in the air? is this because there colliders are a little bit from the ground and the collision happens beneath it? how would i make sure the upwards force on the enemies isn’t to big?
I was using the same physics material on my player and enemy gameobject. I created a new physics material and put in a larger dynamic friction (player was on 7, enemy set to 70) which fixed this problem. Now i just have to find a good #friction.
I have found a great answer to this problem - in 1 specific occurrence at least.
I had some cubes that ran back and forth - and when the player (cube) collided with them - they would stop and slowly push on the player though… - Anyway… this worked fine until one day it started BOUNCING my player up into the sky out of NOWHERE!!! D :
I tried several fixes - only to realize - that my Plane (floor) underneath the cubes had accidentally gotten moved up a few world units (in the z axis) - SOOOO… - now my plane was intersecting with my running cube objects - …
I moved the plane back down - and low and behold … the problem went away. - so watch out for GROUND and surrounding object’s intersecting with your objects that have rigidbodys at start because this can cause a LOT of bad problems. Hope this helps some ppl! : ) Happy GameMaking!