DragRigidBody.js script error

After importing the dragrigidbody.js script to my project and try to build I get this error. How can this be as this is a script taken straight from the standard package?

isKinematic is not a member of UnityEngine.Component

Do i need to import some other script? Is this not supported in Unity Iphone??

cheers

P.S I am very new to this(as you can probably tell :roll:

First off, welcome to the forums! :smile:

I think that the problems may be due to the following lines of code:

26: if (!springJoint)
27: {
28:   var go = new GameObject("Rigidbody dragger");
29:   body = go.AddComponent("Rigidbody");
30:   springJoint = go.AddComponent("SpringJoint");
31:   body.isKinematic = true;
32: }

In particular lines 29 and 31 are suspect. Line 29 adds a component (Rigidbody), but body is then of type Component and not of type Rigidbody (thus the error about isKinematic not being part of a Component, when it is part of a Rigidbody component in specific). I think that the easiest fix is like this:

26: if (!springJoint)
27: {
28:   var go = new GameObject("Rigidbody dragger");
29:   go.AddComponent("Rigidbody");
30:   springJoint = go.AddComponent("SpringJoint");
31:   go.rigidbody.isKinematic = true;
32: }

We have a reference to the game object, after adding the rigidbody component we can access it straight away. Try that! :slight_smile:

I’m getting a similar error and cannot figure out the cause. If you have any suggestions I’d certainly appreciate them.

The script is:

var madness = 1;
var puppet: GameObject;
var flevel = 0;
var ffactor = 0;
var rfactor = 0.5;


function Start () {

    //Set all animations to plsy once
	animation.wrapMode = WrapMode.Once;
	//except breathing
	animation["idle_breath"].wrapMode = WrapMode.Loop;
  
	// play with layers
	// animation["idle_breath"].layer = 0;
	// animation.layers = 1;
	
    //stop any other animations 
    animation.Stop();	
	
	animation.Play("idle_breath");
	
}

function Update () {

   // left slap
   if (Input.GetButton ("Fire1") ) {
      animation.Play("slap_left");
   }
      
   // right slap
   else if (Input.GetButton ("Fire2")) {
      animation.Play("slap_right");
   }
   
   // squeeze head
   else if (Input.GetButton ("Fire3") ) {
      animation.Play("squeeze_head");
   }
   
   // squeeze body
   //else if (Input.GetButton ("Jump") ) {
      //animation.Play("squeeze_body");
   //}     
   // head punch
   //else if (Input.GetButton ("MouseX") ) {
   //else if (Input.GetButton ("Jump") ) {
      //animation.Play("face_punch");
   //}
   
   // bodypunch
   else if (Input.GetButton ("Jump") ) {
      animation.Play("belly_punch");
   }

   else {
     animation.CrossFade("idle_breath");
	 //animation.Play("idle_breath");
    }
	
}

Erm… this doesn’t seem to have anything to do with the DragRigidbody error :wink:

What exactly is the error you are getting with this script?

OK. I jumped the gun. Thanks for pointing it out :slight_smile: My partner is developing the model and I’m doing the scripting and iPhone prototyping. We have a game which builds and runs on Windows in the Web Player. I purchased the Unity upgrade and iPhone module and have not been able to build and run the model once. When I saw the other post with a similar error I assumed it was related to my script.

Thanks!