#show your parenting code is your player

1 messages · Page 1 of 1 (latest)

mental merlin
#

it's a rigidbody

#

private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Player"))
{
collision.gameObject.transform.SetParent(transform);
}
}

private void OnCollisionExit(Collision collision)
{
    if (collision.gameObject.CompareTag("Player"))
    {
        collision.gameObject.transform.SetParent(null);
    }

}
quiet shuttle
#

change the code to be OnTriggerEnter

mental merlin
#

Alright lemme try

quiet shuttle
#

iirc there might be one more step

mental merlin
quiet shuttle
#

just clone the platform, put only boxcollider to trigger. You can disable mesh renderer. I have mine to green for debugging

#

put the script on the trigger

#

something like this

#

parent would be the platform MovingPlatform parent

mental merlin
#

okay let me get clear myself , so I have a parent object MovingPLatformParent a normal gameObject in which there is this moving platform child object with box collider and the script

quiet shuttle
#

it's exactly what u need to do

#

except mine character is Character Controller instead of rigidbody

#

it should work the same

mental merlin
#

Yes I saw it so you have a moving Platform parent in which there is a collider as well as script for the parent correct ?

quiet shuttle
quiet shuttle
#

and has an animator for moving up and down

#

you ofc wanna parent player to the parent that holds it all instead of the platform graphics

mental merlin
quiet shuttle
#

think the parent as the MainObject

#

that holds the whole system

#

if you need more lmk

mental merlin
#

Yeah sure mate ! , anyways thanks for the help

quiet shuttle
mental merlin