# Is it possible to create a rigid body inside of another rigid body?

What I am looking to accomplish is a sphere inside of a semi-transparent sphere. I want the outer sphere to move around controlled by the player but the inner sphere to sort of float around only rotating if the outer sphere applies enough force. Basically I want the inner sphere to lean with the outer spheres movements but not actually rotate with it. Any suggestions on how this might be accomplished?

If you are at all familiar with Jurassic World I am basically trying to accomplish something very similar to the Gyrosphere vehicle. Anything to point me towards getting this done is greatly appreciated, thanks!

Check out the physics spring joint. You could attach your smaller sphere to the outer one and it’ll bounce around, it’ll take some work to get the values right so it will stay inside of the outer sphere. You may need to set up some colliders around the outer sphere to help keep the smaller one in bounds. If the larger sphere and smaller have overlapping colliders make sure to prevent them from colliding with the physics settings!

After hours of fiddling I gave up on the idea of the ball bouncing around inside. I do want it to respond to impact but I will work on that later. Right now I am currently trying to get it to rotate towards the angle of the joystick. I seem to be able to get it to work on the y and z axis but for whatever reason when I try the X axis I am unable to get it to lean forward and backwards. I am not even exactly sure how this math is working otherwise I would be able to figure it out but I just don’t understand the math function or how it is even working at all. Anyways here is what I have so far:

``````using UnityEngine;
using System.Collections;

public class InnerMotor : MonoBehaviour {
public GameObject outtershell;
public VirtualJoystick joystick;
private Vector3 shellpos;
private float joypos;

void Update () {
shellpos = outtershell.transform.position;
transform.position = shellpos;
joypos = Mathf.Atan2(joystick.Horizontal(), joystick.Vertical()) * Mathf.Rad2Deg;
transform.eulerAngles = new Vector3(transform.eulerAngles.x,joypos,joypos);
}
``````

Sorry I know it is a slightly different question at this point but any help appreciated. Thanks