3rd person rotate around sphere.
I am wondering how I would go about making a ball roll around a bigger ball. For example, What I would like to do is be able to use the roll-a-ball tutorial (or something similar), but instead of having the ground being flat, have it be a sphere. I have sort of achieved this, but it does not work properly because the ball rotates oddly and the ball sometimes jumps off of the sphere and glides back (like a rubber band). I think that it may need to be re-written from the ground up. Could you help me find out how to do this or point me in the right direction?
Thanks in advance!
Here is my code for the large sphere that is the ground for the ball to roll on:
public void FixedUpdate() {
foreach (Collider collider in Physics.OverlapSphere(transform.position, pullRadius)) {
// calculate direction from target to me
Vector3 forceDirection = transform.position - collider.transform.position;
// apply force on target towards me
collider.GetComponent<Rigidbody>().AddForce(forceDirection.normalized * pullForce * Time.fixedDeltaTime);
}
}
Your answer
Follow this Question
Related Questions
3rd person movement with camera between platforms with gravity 0 Answers
Need help with my 3RD person Script being buggy!! 0 Answers
3rd Person Camera Controller, Character should follow the Camera Movement 0 Answers
RIgidbody sphere falls through plane 2 Answers
Scripting Problem Please Help Me to adjust this Script 0 Answers