Hi, I’m having a bit of trouble with modifying the spring values from a hingejoint. (using c#)
here’s my code
if (Input.GetMouseButtonDown(1) && !opgepakt)
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, rayLength, mask))
{
opgepakteShit = hit.transform.gameObject;
opgepakt = true;
opgepakteShit.AddComponent<HingeJoint>();
opgepakteShit.hingeJoint.spring.damper = 2.0f
}
}
This is the error it gives me (which I don’t understand):
“Cannot modify the return value of “UnityEngine.HingeJoint.spring” because it’s not a variable.” How is this not a variable?
I’ve even tried copy pasting the exact code from the script reference:
here
It still gives me the same error, can somebody please help me understand what is going on? thnx