- Home /
Two rigidbody's overlap instead of colliding
Hi i am making a kind of a hockey game however when i hit the puck from the side with the player they instead overlap and the puck stops. Afterwards when the player goes out from the puck it seems like the puck is added that energy, however little. Both objects have rigidbodys attached, and the player have a box collider attached, and the puck have a capsule collider attacher, former a mesh collider with the same results. Both rigidbodys have Continous Dynamic collision detection, and Interpolate is set to Interpolate.
I have tried to do it only with the physics engine, moving the player with addforce, which for some reason works, kinda, atleast the colliders don't overlap however the puck transfers most of its energy to the player and therefore more or less stops, is there a way to do this so that the puck doesn't loose energy?
Answer by Baste · May 21, 2015 at 01:27 PM
Are you moving your objects by setting transform.position or doing transform.Translate?
In that case, you're teleporting the objects to the new spot, and collisions won't be simulated properly. If you want to have collisions have an effect, you'll have to use physics to move the things.
If AddForce isn't working out for you, try setting the velocity directly. Also make sure that the puck and the player have sensible settings for mass - if the player and the puck has the same mass, the puck will push the player as hard as the player would push the puck.
Hi Baste, i think you'r right, it is probably teleporting to it. The puck is moved by using addforce, however the player is moved by setting transform.position.
If i were to move the player with addforce is there a way to stop the puck from giving all of its energy to the player without setting the players mass incredibly high? I only ask because i've tried that and it seems to make the movement quite sluggish and slow, but that may be because my speed isn't high enough?
Try setting the puck's mass to almost nothing.
Also, post replies to answers as comments, not answers! I converted your answer to a comment for you. Answers are supposed to be solutions to the original question.
I will try that in a bit, thank your for your response.
Sorry, you'r right forgot that i should use the comment feature :)
i set the mass to very little and just adjust the position, it will always move it a little bit i guess, thanks for the help