- Home /
FixedJoints wiggling when too many are put together?
hi i have this script
var obj : FixedJoint;
var wallParts : int = 20;
function Start () {
for(i=wallParts;i>0;i--){
var cube = Instantiate(obj,Vector3(transform.position.x+i,transform.position.y,transform.position.z),transform.rotation);
cube.gameObject.name = "brick" + i.ToString();
cube.transform.parent = transform;
if(i <wallParts){
var cubes = GameObject.Find("brick"+(i+1).ToString());
cube.connectedBody = cubes.rigidbody;
}
}
}
So what this does is creates a wall of fixed joint cubes. all of them are connected to the next one. but it seems to not hold together when i make it large enough. any help would be nice!
Answer by spinaljack · Jun 26, 2010 at 10:54 AM
Generally you should limit the length of joint chains but there are ways to make it more stable. Switching to a configurable joint and setting a higher dampening value will stop it jittering so much. (fixed joint is just a configurable joint with less options).
You can also set a higher linear limit to lessen the snap back effect from too many joints.
You can also do things like setting higher drag value on the rigidbodies and making them all sleep at the start of the game to stop them moving around right away also helps. If the cubes are stacked on top of each other you can also set a higher penetration value in the physics setting to allow the cubes to move into each other a little bit more before being forced apart which might be what's causing the jitter.
e.g.
function Awake(){
rigidbody.Sleep();
}
Your answer
Follow this Question
Related Questions
How do I connect two objects together in the scene? 1 Answer
Smart camera? 1 Answer
Trying to walk on a wall 0 Answers
ANSWER DETERMINED (CAN'T DELETE) 1 Answer