- Home /
Issue with Collisions due to Parenting script
After doing some research on how to have a player collide with a moving platform, I used this method from (http://answers.unity3d.com/questions/8207/charactercontroller-falls-through-or-slips-off-mov.html).
I created a child of the moving platform, gave the child a Kinematic-enabled Rigidbody, deactivated the child's render mesh, made it the exact size of the parent moving platform but with a collider that extends just slightly above, set the collider as a Trigger, and gave it this Javascript:
#pragma strict
function Start () {
}
function OnTriggerEnter (other : Collider)
{
other.transform.parent = gameObject.transform;
}
function OnTriggerExit (other : Collider)
{
other.transform.parent = null;
}
By stopping the platform's movement (with a button press) and then having the player jump on, I get proper collisions. However, when I try to jump back to a nonmoving platform, the player is unable to collide with default nonmoving platforms unless I stop the moving platform's movement. Why is this?
$$anonymous$$aybe you could use a Collider.OnTriggerExit(other : Collider) to set collisions back the way they were before?
The only thing I did collisions-wise was to add a $$anonymous$$inematic Rigidbody to the child object. The Box Collider it has is a trigger collider. When I try adding the parent script to nonmoving platforms( so that the player becomes a parent of them), I am unable to collide with the moving platform entirely unless it is not moving.
Your answer
Follow this Question
Related Questions
Platform Mover continued 1 Answer
How to make platform detonate when player collides? 3 Answers
Some wierd problem. 1 Answer
Character getting stuck on curbs.. 0 Answers
Sphere falling through floor 11 Answers