- Home /
What is the best way to create a balance board?
I would like to create a board that tilts and balances depending on what kind of weight is on it, and what edge it's toward - IE, if a box is on one edge of it tilt towards that direction, unless there is another equal weight on the other end. At the moment I'm messing with joints to see if that will produce the desired effect, and it's been interesting but not entirely effective. It tends to get wacky when more then one object is on the balance. My goal is to create something like this: Equanimity
Answer by aldonaletto · Dec 16, 2012 at 03:38 AM
You can get good results using rigidbodies and a hinge joint: create a simple cube, add a rigidbody and a hinge joint, then set the parameters like below
If you want to test its behaviour, attach this simple script to the balance:
var colors: Color[] = [Color.red, Color.blue, Color.green, Color.gray, Color.yellow];
private var plane: Plane;
function Start () {
plane = new Plane(Vector3.back, transform.position);
}
function Update () {
if (Input.GetButtonDown("Fire1")){
var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var dist: float;
if (plane.Raycast(ray, dist)){
var block = GameObject.CreatePrimitive(PrimitiveType.Cube);
block.transform.position = ray.GetPoint(dist);
block.AddComponent(Rigidbody);
block.rigidbody.drag = 1.0;
block.renderer.material.color = colors[Random.Range(0, colors.length)];
}
}
}
Almost perfect, thank you! $$anonymous$$y own results didn't get close to that, although I did disable gravity. Don't want the balance to fall off the game window.
GUYY YOU SAFE $$anonymous$$Y LIFE YOURE THE BESTT THAN$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$$$anonymous$$ YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU IVE SEARCHED FOR THIS TOO $$anonymous$$UCH ONLY YOU HELPED $$anonymous$$E THAN$$anonymous$$SSSS VERYYY $$anonymous$$UCHHHH =)
Your answer
Follow this Question
Related Questions
Configure configurableJoint to act as the disctontinued driveJoint 0 Answers
Hinge Joint On Little Noodle Carton (with pic) 1 Answer
Throwing object with force 1 Answer
Make connected rigidbody pull "parent" rigidbody with joint 0 Answers
Connect rigidbody to another moving rigidbody to simulate a hanging weight 0 Answers