Want to add Oscillator script on one of the Helper Obstacle

I had applied oscillator script on this blue obstacle and it is working fine. What I want to do is if the player lands it’s rocket on that helper obstacle then the rocket should also move according to that helper obstacle movement and currently the rocket get’s dropped from the helper obstacle as soon the obstacle moves.
For doing so, I am thinking that if some how i can call the oscilator script in the switch case, when the the rockets touches the helper obstacle then it may move according to the speed of the helper obstacle.
Help me to do so beacuse I am stuck at that point or if you have any better solution please suggest.


Try setting the platform as the rocket’s parent as soon as it lands and then remove it again when the player flies the rocket again

// psuedo code - set the parent
rocket.transform.SetParent(pltform.transform);
// unset the parent
rocket.transform.SetParent(null);

can you help me to set transform.setparent on the obstacle. How could I call the Obstacle(8) gameObject of game in my CollisionHandler script and here ‘body’ in body.transform refers to the rocket.


You want to set the platform you are landing on (colliding with) as the parent

case "Helper":
    body.transform.SetParent(collision.transform);
    break;

This should be enough. In your screenshot, however, the tag on Obstacle (8) is ‘Friendly’, not ‘Helper’ so it will not execute that code

Privacy & Terms