unity3d - Unity - Parent with children fall apart -


i have player character, made of cubes, spheres , capsule. created empty object player , body parts of player child of player. have 2 planes, moving platform in between. can walk , jump on normal planes , walls, when player on moving platform bodyparts of player fall apart. maybe it's stupid, started unity.

this goes wrong, player falls apart on moving platform: http://nl.tinypic.com/r/207s3sz/9

and below information overview, player, body parts, , moving platform according character-holder. bodyparts have same properties body part on screenshot. can me goes wrong here? how can transport whole player moving platform?

enter image description here

enter image description here

holdcharacter script:

using system.collections; using system.collections.generic; using unityengine;  public class holdcharacter : monobehaviour {      void ontriggerenter(collider other) {         other.transform.parent = gameobject.transform;                             }      void ontriggerexit(collider other)     {         other.transform.parent = null;     } } 

you need disable istrigger flag. here insights

so how trigger works that... fire ontriggerexit , ontriggerenter, let object go through it. if disable istrigger, need move logic oncollisionenter on oncollisionexit methods. if istrigger uncheck kind of worked, maybe fact move logic holdcharacter oncollisionenter , oncollisionend respectively this:

void oncollisionenter(collision collisioninfo) {     collisioninfo.gameobject.transform.parent = gameobject.transform;  }  void oncollisionexit(collision collisioninfo) {     collisioninfo.gameobject.transform.parent = null;  } 

regards


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -