I desperately need to be able to create joints via script. Currently I add and then set them up and they sort of work but something is clearly wrong, Motion and Angular Motion that are supposed to be locked are not locked, PositionSpring can only add a weak amount of force and position damper actually reduces that force without actually adding any damper.
Duplicates of these assemblies actually get progressively worse. I've tried setting .active to false just before and after .AddComponent with no effect. I have the same problem instantiating prefabs with joints, and creating joints via the editor with the game running.
Is there no way to add a Configurable Joint with the game running?
Don’t create and add a joint from scratch, let AddComponent(FixedJoint) create it and return it, then define it’s values and there you are. In this example, it’s working with a fixed joint, but I tested it out and it’s working with any of the predefined ones.
I found while using scrips, C#, The Rigidbody falls asleep. You need to wake it up within the script during each update. It is a bad idea to mess with a Quaternion directly. You should set XYZ in Euler angles with a vector3.
public Vector3 Vec1; Then you set your Quaternion with it, this way: private Quaternion QVec1; QVec1 = Quaternion.Euler (Vec1); QVec1 would be your set Quaternion with the angles you wish it to have. This is my vid on the subject you ask about, if you wish to check it out. Link: ConfigurableJointScript 1
The vid tells how to properly set TargetRotation within a script, and have it work!
Hope this helps. Oh’ you can keep you $20 if it does help you.