- Home /
Parent GameObject dosen't move anymore if the children have a rigidbody
Hello Unity Community ;)
My game looks like this:
There is a Player with an Particle System. (Each Particle is a bullet) The red circle are an enemy. It has a rigidbody and moves in one direction. If a bullet collied with that enemy it will be die.
So that works perfect, but now the problem:
The Enemy get some Child Shield Circles. So the should be move with the Parent but should be die alone if it collides with a Particle. So my idea is that I give each Child a rigidbody with "isKinematic". (Because it needs an rigidbody because only with that it detects the Particles)
But now the Enemy dosnt move anymore. It stand still.
Can someone help me? ;)
BTW: If I make only 1 children (one blue circle) it moves. But with some more it stand still.
is$$anonymous$$inematic means it won't be movable, but can still detect collisions. If your bullets have Rigidbodies then your shields only need colliders.
Ok thanks, i have removed the rigidbodies and added Collider but now the "void OnParticleCollision(GameObject other)" function on the Child Gameobject does nothing if a particle collide with a child :S
The OnCollisionEnter does work. (If the Player collide with an EnemyChild) Its only a problem with the OnParticleCollision.
is$$anonymous$$inematic will lead to the physics engine not simulating that object. This means, it will only change its position, when you tell it to via a script.
$$anonymous$$aking is$$anonymous$$inematic false will make the shield objects be simulated independently from your enemy object, leading it to not move with it at all. You can tie their movement together by using a FixedJoint or FixedJoint2D.
Okay, I'll post this as the answer so you can give me those sweet, sweet internet points! ;)
Answer by NoBrainer-David · May 13, 2017 at 06:37 PM
isKinematic will lead to the physics engine not simulating that object. This means, it will only change its position, when you tell it to via a script.
Making isKinematic false will make the shield objects be simulated independently from your enemy object, leading it to not move with it at all. You can tie their movement together by using a FixedJoint or FixedJoint2D.
Answer by ddsinteractive · May 13, 2017 at 06:36 PM
How about using colliders instead of the RigidBody. Does it still fail to move?
Also, what settings have you given the Rigidbodies other than the isKinematic checkbox?
Cheers, Monica
Your answer
Follow this Question
Related Questions
Send message to other objects in list 0 Answers
Extreme slowdown during move request 1 Answer
Empty Object as Parent without Rigidbody? 0 Answers
Hinge to a child, Parent has rigidbody 1 Answer
Change an object's grandparent 2 Answers