control rigidbody with dynamic colliders
Hello
I am making a simulator for Lego Mindstorms (Maybe you already heard about it). The user can create his own robot, that he can control through the motor powers. The robot is a gameObject with the rigidbody, with motors and plates as children with colliders. As a consequence, the robot has to be able to move according to each motor speed thanks to the following code:
float leftSpeed = brickManager.getMotorAtPort(movementsMotor1).speed;
float rightSpeed = brickManager.getMotorAtPort(movementsMotor2).speed;
GetComponent<Rigidbody>().velocity = transform.forward * (leftSpeed + rightSpeed) / 2f / 360f * wheelDiameter * Mathf.PI;
GetComponent<Rigidbody>().angularVelocity = Vector3.up * ((leftSpeed - rightSpeed) / 360f * wheelDiameter * Mathf.PI) / (axleTrack * Mathf.PI) * 360f;
However, I met my first issue: the rigidbody behaviour was not what I expected. He has some diffulties to rotate, and cannot translate at all since it overbalances.
My second issue is that some plates in the robot can move thanks to some motors, and the behaviour is going to be strange since these plates have no rigidbody. But I would like to fix my first issue before tackling this second issue, so that I can make more tests.
Thanks in advance.