JointDriveMode is obsolete, any alternatives?
I had a C# code where i'd use JointDriveMode to set Configurable Joint data directly from code.
[SerializeField]
private JointDriveMode mode;
[SerializeField]
private float jointSpring = 20f;
[SerializeField]
private float jointMaxForce = 40f;
Now that it's obsolete, what do i do? I need an alternative for my code to work.
I've got the same problem. $$anonymous$$y code add configurable joints on the fly and sets the mode to either Position or Velocity. So, how am I supposed to do this now? The docs say something about the flags were incorrectly applied anyway - but what's the work around?
$$anonymous$$ight as well credit the above code to Brackeys tutorial on youtube: $$anonymous$$aking a $$anonymous$$ultiplayer FPS in Unity. I'm at the same point as well after an upgrade to 5.3.
Yeah, I was working with the same thing and there doesn't seem to be any easy way to replace JointDrive$$anonymous$$ode that's compatible with this method at all.
Answer by yakri · May 21, 2016 at 03:17 AM
Alright, as far as I can tell from my research, the mode functionality is gone, so you just comment out
//[SerializeField]
//private JointDriveMode mode;
and then also remove the commented out code here
private void SetJointSettings(float _jointSpring)
{
joint.yDrive = new JointDrive
{
//mode = jointMode, //remove this here
positionSpring = _jointSpring,
maximumForce = jointMaxForce
};
}
the joint mode functionality here. I'm fairly sure instead you just have to tweak some things about your joint in the unity editor, or use a configurable joint from the start if you really want the same effect Brackey's achieved. I don't really know what joint mode did but it doesn't exist anymore, however I am fairly sure that it's functionality exists via multiple varied settings in configurable joint.
see: http://docs.unity3d.com/Manual/UpgradeGuide53.html at JointDriveMode Flags
Can confirm, just commented the mode section out, no more errors and the player still moves the same way. Thank you Yakri
Answer by meeruTheCoder · Nov 07, 2018 at 12:09 AM
Thank you! It works completely fine without that code, so I wonder why they made it unusable?
Your answer
Follow this Question
Related Questions
Adding Gravity to a game object to make a black hole sucking effect. 1 Answer
Rigid body robot animation 0 Answers
How to fix this problem? 1 Answer
Ball Speed is not increasing as per code 0 Answers
Problem. Pick up and Grab object script, except all objects in scene are picked up instead of one. 0 Answers