- Home /
2D physics, animation-controlled kinematic colliders not affecting momentum
I have an object that is controlled by an animation (it is a simple box collider and the animation kicks it upwards quickly before returning slowly to its original position, and it does this on a loop), in an attempt to create a kind of kick tile that catapults objects that land on it upwards.
The problem is that the objects on the top of the tile do not achieve any kind of upward velocity. They get pushed out of the way, that is they physically move upwards, but they don't start moving upwards; their velocity is unaffected and no momentum is transferred.
I have made sure that the platform's Animator is set to Animate Physics, and that the Rigidbody 2D is set to Is Kinematic. Both the bounce pad and the object on top have a physics material, with a non-zero bounce value for what that's worth (I tried with 0 bounce and 1 bounce and same deal). I have experimented with different masses as well. Same deal. I know it's not that anyway because if I set the object's gravity to 0, the pad just pushes it up, and there it stays, instead of shooting off upwards forever.
I've tried all combinations of settings for interpolation and collision detection on both interacting objects. Nothing enables the platform to transfer momentum to the object on top.
I have also tried attaching a dynamic (non-kinematic) 2d box as a child of the platform. It doesn't work, and has the additional problem of not matching the animation anymore.
For what I want to do, I really don't want to add hacks like detecting collisions and then adding some force to the object from a script.
Any ideas / explanations?
Answer by MelvMay · Mar 23, 2016 at 06:30 PM
At a guess; If you're animating the position of an object then it is just being re-positioned and doesn't have any velocity (energy) so it won't pass that onto other colliders it overlaps (yes, it'll overlap, not contact edges as you're repositioning it over other colliders and the physics system will just solve the overlap.
Is there a proper way to have animated objects "hit" dynamic objects with some velocity? I'm running into this same problem, trying to get an human player-character (animated object with a hierarchy of body parts) to hit a ball (simple, dynamic object) in a volleyball game.