Both Kinematic and Non-Kinematic behaviours at the same time.

Hello everyone,
i am currently running into a problem, which can’t be easily solved, so i am looking for any advice that could help.

I got an 3D Sphere as Energy Shield with a rigidbody and collider on it.

If i put this object on “kinematic” (picture 1), and control all movements and collisions by script, then its moving fine with the player together, until it collides with some enemies / hazards. The hazards / enemies won’t bounce correctly as the physics engine does not capture the collisions, and the enemies / hazards often enter the shield until they collides with the player. I can only prevent this by adding negative force to the enemies / hazards, but it is not working fine, as there are fast moving objects in the game, so they hit both the sphere and the player.

If i put the object off kinematic (picture 2), which means fully physically working, the collisions are captured perfectly, but the system won’t let me put it “on” the player object. I tried it with setting player as parent, setting the transform manually to the same as the player, but it always get “pushed away” as soon as it appears.

Anyone?
98245-2017-07-24-14-38-28-spaceshooterx.png
98244-2017-07-24-14-37-38-unity-562f1-personal-64bit-mai.png

ok after some testing and trials, i found out the following:

  • removing rigidbody from the shield sphere object makes it perfectly surrounding the ship, and following it, but the collider does not to seem work anymore (OnCollisionEnter with debug.log gives nothing)
  • physics.IgnoreCollision given both colliders of ship and shield sphere makes it possible that both objects overlap, but the sphere does not move with the parent ship anymore even when i use shield.transform.SetParent(player.transform); shield.transform.localPosition = new Vector3 (0.0f, 0.0f, 0.0f); , Debug gives strange values, when moving the ship along the z axis, the values of the shield localposition are way off, but on screen its barely moving a pixel