0
\$\begingroup\$

Im making a 3rd person 3D game. I have a little capsule shaped player controlled drone at the moment that moves on a flat surface. Y axis is locked. The Game object contains a script and then the child objects which are the actual body parts. If i attach a rigidbidy to the root object i get crazy results. The drone collides with something and starts to spin and then forward becomes some upward direction.

Somehow i would like to be able to use the pysics collision and ragdoll effects but still be able to maintain the keyboard movement. I guess that id have to animate the drone getting back up again when fallen.

Movement code

 void CheckForKeys () { if (Input.GetKey(KeyCode.W)) { transform.Translate(Vector3.forward * Time.deltaTime * walkingSpeed); } if (Input.GetKey(KeyCode.S)) { transform.Translate(Vector3.back * Time.deltaTime * walkingSpeed); } if (Input.GetKey(KeyCode.A)) { transform.Rotate(Vector3.up * Time.deltaTime * rotatingSpeed); } if (Input.GetKey(KeyCode.D)) { transform.Rotate(Vector3.down * Time.deltaTime * rotatingSpeed); 
\$\endgroup\$
3
  • \$\begingroup\$ You could, rather than just translating the object, apply a force to it instead. That should remove some of the issues with the RigidBody. \$\endgroup\$ Commented Nov 19, 2013 at 23:24
  • \$\begingroup\$ I think you must have problems with your colliders. Which objects have colliders in your drone object hierarchy? If the root and child objects have colliders that intersect from the beginning, the physics can present weird behavior. \$\endgroup\$ Commented Nov 21, 2013 at 14:56
  • \$\begingroup\$ @dsilva.vinicius yes this is definitly what happened. Thanks! \$\endgroup\$ Commented Nov 21, 2013 at 14:59

1 Answer 1

0
\$\begingroup\$

If the root and child colliders intersect from the beginning the physics can present weird behaviour.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.