- Home /
How does one modify spring values?
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
Comment
Your answer
Follow this Question
Related Questions
ConfigurableJoint simple spring 1 Answer
Why Fixed Join behaves like spring? 2 Answers
Joint confusion - Bobble head 0 Answers
Spring in unity 0 Answers