- Home /
Charecter not moveing with platform ( i know its been asked a million times)
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.
Answer by redcap · Jan 14, 2017 at 08:02 AM
I asked a similar question a few hours ago and am still waiting on the solution. I can tell you your issue though. MovePosition can only be used if the gameobject does not have a parent. Or so it seems. So if your character is using MovePosition this is why they stop being able to move. What is the solution? I don't know and am eager to see if anyone answers this as well.
the $$anonymous$$ovePosition is on the empty gameobject and has no parents, good to know though. thanks
Your answer
Follow this Question
Related Questions
Moving Platform with delay not working 0 Answers
C# player rigidbody, permaTransfer and moving platform 0 Answers
Can't get platform to move to the other direction 2 Answers
How to make a moving platform? 2 Answers
Moving platform and friction problem 1 Answer