0
\$\begingroup\$

In my game the player can fly to multiple spheres, I want to make it so that when the player gets within a certain distance of the sphere, (maybe using a bigger is trigger sphere collider around it?) their feet will stay pointing towards the sphere until they leave the radius, (maybe using a quaternion?) then if they get within the radius of a different sphere, their feet will point towards that too. How can I make this work? I don't know too much about c#, so any example code would help a lot too!

\$\endgroup\$
2
  • \$\begingroup\$ Can you show us the player movement code you have so far, so we can suggest solutions that will work with that? \$\endgroup\$
    – DMGregory
    Feb 22, 2021 at 12:10
  • \$\begingroup\$ I don't have much so far, I just want to make the bottom of an object always point towards a sphere, without restricting rotation on other axes. any solution that automatically adjusts the rotation towards the sphere when within the radius should work \$\endgroup\$
    – anura
    Feb 22, 2021 at 14:38

1 Answer 1

0
\$\begingroup\$
void Update () {

...

transform.rotation = Quaternion.LookRotation(forwardAxis, upAxis.z,);
}

this worked! although it made the camera jittery so i'll have to figure out rotation with rigidbody physics

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .