Parent with children fall apart
Hello,
Probably it's something really stupid, but I just started with Unity.
I have a player character, made of some cubes, spheres and a capsule. I created the empty object 'Player' and all body parts of the player are a child of 'Player'. I have two planes, with a moving platform in between. I can walk and jump on the normal planes, but when the player is on the moving platform the bodyparts of the player fall apart.
All apart body parts have a box/sphere/capsule collider, and mesh renderer is enabled. The parent 'Player' has a rigidbody with gravity, and a move script.
The moving platform has a box collider with 'is trigger' disabled, and it has a mesh renderer. It has a child 'Character Holder', which should ensure that the player remains on the moving platform when it moves. This Character holder has a box collider, mesh renderer disabled, and a script attached. I don't know if it's important, but the short code of this script is this:
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;
}}
I used https://www.youtube.com/watch?v=AfwmRYQRsbg to create the moving platform.
Does anyone know how I can make sure the player does not fall apart when I jump on the moving platform, so that it can transport the player?
Your answer
Follow this Question
Related Questions
How to change image sprite with text multiple times with button? 1 Answer
can I Cutoff/Blackscreen part of the unity camera screen? 0 Answers
Asset Store window is blank - again 6 Answers
How can I edit materials on the model I brought from Sketch-up?,Hi, 1 Answer
How to get a box cast to fit around the GameObject? 0 Answers