- Home /
Question by
AlejovDeveloper · Dec 06, 2017 at 08:20 PM ·
rigidbody2dphysics2djointswheels
Set connected Rigidbody 2D to a WheelJoint2D via script.
Hi, I am creating a car via script, but i don't know how to set the connected rigid body because the variable is only {Get;}.
Here is the script where i try to.
if (currentGameObject.CompareTag("Wheel"))
{
WheelJoint2D wheelJoint = (WheelJoint2D)carObject.AddComponent<WheelJoint2D>();
wheelJoint.useMotor = true;
JointMotor2D motor = wheelJoint.motor;
motor.motorSpeed = 1000;
wheelJoint.motor = motor;
}
Comment