- Home /
How do I change the position spring value in the angular X drive of a configurable joint
I am trying to make a customs ragdoll using configurable joints and am trying to have the player press a button to go completely slack
if(Input.GetButton("Flop"))
{
foreach(ConfigurableJoint j in joints2000)
{
j.angularXDrive.positionSpring = 0f;
}
}
this is my code so far but it throws a Cannot modify the return value of 'ConfigurableJoint.angularXDrive' because it is not a variable error any help is appreciated
Answer by DenisIsDenis · Jun 05, 2021 at 02:06 AM
Try to replace this code:
j.angularXDrive.positionSpring = 0f;
with this:
JointDrive jointDrive = j.angularXDrive;
jointDrive.positionSpring = 0f;
j.angularXDrive = jointDrive;
After all, JointDrive is a structure, so it is better to change it through another variable, which is this structure.
Your answer
Follow this Question
Related Questions
Configurable joint axis aren't working with local space 0 Answers
How to have a character hold teddy bear in hand, using ragdoll and joints? 1 Answer
weird behaviour configurable joint Strecthing when Draging 0 Answers
Standard ragdoll insufficient for standard model? 4 Answers
Ragdoll problem with animations 0 Answers