- Home /
Position of skinned mesh with rigidbody on bones.
I have problem with get the position of my object. It's nothing more than rigged cube with collider, rigidbody and spring joints on each bone. I want to get position, rotation etc. but it wont work like for other rigidbodies. After the game starts my object fall down but position stays as before :( I think it's easy to see on this video.
Answer by jakobo55 · Mar 27, 2015 at 08:30 PM
Ok i've found solution :) Just create object "center" and add this script.
public GameObject[] Bones;
Vector3 center;
void Update ()
{
for(int i=0; i < Bones.Length; i++)
{
center += Bones[i].transform.position;
}
center = center / Bones.Length;
transform.position = center;
}
Then just get the position of this object. It should be placed in the middle :)
Your answer
Follow this Question
Related Questions
Adding a rigidbody to an array? 1 Answer
How to remove internal triangle/faces when combining mesh 0 Answers
Inconsistent collision detection on slow-moving objects 0 Answers
Mesh Filter not appeared in my unity project 2 Answers
Attaching multiple rigidbodies together and spawnning as prefabs 1 Answer