i have an empty gameobject and parented to that is my platform both with rigidbodies both with gravity off and kinematic on. on the empty game object i have this code that parents the character to the empty gameobject at start and moves the empty gameobject forward. the platform moves with the empty gameobject but the player dos not.
using UnityEngine;
using System.Collections;
public class moveplatform : MonoBehaviour {
public Rigidbody emptyplatform; // empty gameobject
public GameObject player;
public GameObject empty; // same empty gameobject
void Start() {
emptyplatform = GetComponent<Rigidbody>();
player.transform.parent = empty.transform;
}
void FixedUpdate() {
emptyplatform.MovePosition(transform.position + transform.forward * Time.deltaTime);
}
}
my character has a rigidbody with gravity on and kinematics off. if i turn on kinematics the character will move with the platform but i cant walk around anymore. i just want my character to be able to jump on a moving platform and be able to walk on the platform as it moves. why is it so hard? if anyone can help, please explain it to me like I’m an idiot because I am one.