Ride across a tree?


I have an object (Player) who is falling from a tree. Now when the object hits a concerned object, I want the player to move around the tree. At this time, the control is disabled from the player. Before hitting the concerned object, the camera is placed to the top of the GObject and it follows it during it’s journey. Now it has to snap to the GObject (Player) before take-off. We could disable the GObject untill the journey is finished.

Description :

Upon hitting an object, the camera has to come to the player and he has to fly around the area. The area
is defined by the radius from the center (trunk).

Experience :

It is just a round-a-bout around the trunk of the tree. The ride is the experience of a journey around the tree. There is a start and that journey ends at certain point. That end could be based of time or a position. Once it ends it’s journey, the camera re-positions itself.

Constraints :

  1. There is a trunk at the center. Hence he cannot pass through the trunk.
  2. Area of Radius ‘r’. i.e. He can travel between the radius ‘r’ from the center and can’t pass thro’ the trunk.
  3. The Player usually is falling down. Hence upon obtaining this, he has to go up & not down.
  4. The ‘path’ of travel has to be defined during runtime.

Possible Solutions/ Problems :

  1. Use Prime31’s Go Kit.
  2. When the camera zooms to the player, the player disappears and the camera flies around. It then checks the final position. How do I zoom in? I cannot use Lerp or Slerp as they might be really slow to snap to the player before take-off.
  3. Once it reaches the final position, it re-position itself to have the GObject back in view.

Thank you and I would like to know if I have missed any information to make things comprehend-able.



is this for a phone or a pc game?

Using raycast to keep the feet of a player always attached to the tree would be an easy way to make sure that as the player moves the bottom of his feet remain parallel to the normal of the hit point on the cylinder (tree).

something like

raycast(from player to -player.up, out hit);

raycast(from hit.point to player, out hit2);

rotate(from hit2.normal to hit.normal in axis cross(hit.normal, hit2.normal));

now the feet will remain parallel so just tell the player to go forward. the circling of the collider will resolve its own self.

turning as well is allowed you can move however you want around the trunk and you will alawys have your feet against it . The ground is now the cylinder.

He won’t pass through the cylinder as long as its a collider.

he will be allowed to move up if you disable gravity or disable gravity on him or mark his as kinematic for the journey.

Your path can be whatever you want you can feed it a path or the player can run it themselves.

Lastly you can in fact lerp to the player just do a lerp whereby the further you are from the player the faster the speed.

speed = vector3.distance(player, camera);
now the greater the distance the greater the speed

lerp(from, to, time.deltatime * speed);

I think that covers just about everythign. :slight_smile: