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 Moving Platforms Unity C# Scripting Tutorial - YouTube 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?