scale geometry based on player coordinates?

Sorry but I’ve looked around the forums and haven’t yet found an answer.

Basically, I’m designing a simple first-person navigation space where the player walks around a giant sphere (movements are restricted to forward and backward, and the player cannot turn around or mouse-look.) The player begins looking at a portal/plane, but as the player approaches the portal/plane, it shrinks. The player must back away from the plane, watching it grow, and make one full revolution around the sphere in order to pass through the plane.

I believe script would need to stop after one full revolution, or else i envision the plane would shrink immediately?

Please help!

Thanks to all and much appreciated.

You have the following information:

  • Position of the plane relative to the sphere center (call that planePos).

  • Position of the player relative to the sphere center (call that playerPos).

With those in hand, you can use Vector3.Angle to get the angle between them and adjust your plane/portal size as needed. Note that Vector3.Angle won’t return a value of 0 to 360, rather it ranges from -180 to 180. But either way you should be able to use it and track your player’s motion and get the desired effect.