Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

DragRigidBody.js script error

Discussion in 'Editor & General Support' started by grimmy, Feb 7, 2009.

  1. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    394
    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:
     
  2. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    First off, welcome to the forums! :D

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

    Code (csharp):
    1. 26: if (!springJoint)
    2. 27: {
    3. 28:   var go = new GameObject("Rigidbody dragger");
    4. 29:   body = go.AddComponent("Rigidbody");
    5. 30:   springJoint = go.AddComponent("SpringJoint");
    6. 31:   body.isKinematic = true;
    7. 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:

    Code (csharp):
    1. 26: if (!springJoint)
    2. 27: {
    3. 28:   var go = new GameObject("Rigidbody dragger");
    4. 29:   go.AddComponent("Rigidbody");
    5. 30:   springJoint = go.AddComponent("SpringJoint");
    6. 31:   go.rigidbody.isKinematic = true;
    7. 32: }
    We have a reference to the game object, after adding the rigidbody component we can access it straight away. Try that! :)
     
  3. shumno

    shumno

    Joined:
    Jul 28, 2009
    Posts:
    29
    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:
    Code (csharp):
    1. var madness = 1;
    2. var puppet: GameObject;
    3. var flevel = 0;
    4. var ffactor = 0;
    5. var rfactor = 0.5;
    6.  
    7.  
    8. function Start () {
    9.  
    10.     //Set all animations to plsy once
    11.     animation.wrapMode = WrapMode.Once;
    12.     //except breathing
    13.     animation["idle_breath"].wrapMode = WrapMode.Loop;
    14.  
    15.     // play with layers
    16.     // animation["idle_breath"].layer = 0;
    17.     // animation.layers = 1;
    18.    
    19.     //stop any other animations
    20.     animation.Stop();  
    21.    
    22.     animation.Play("idle_breath");
    23.    
    24. }
    25.  
    26. function Update () {
    27.  
    28.    // left slap
    29.    if (Input.GetButton ("Fire1") ) {
    30.       animation.Play("slap_left");
    31.    }
    32.      
    33.    // right slap
    34.    else if (Input.GetButton ("Fire2")) {
    35.       animation.Play("slap_right");
    36.    }
    37.    
    38.    // squeeze head
    39.    else if (Input.GetButton ("Fire3") ) {
    40.       animation.Play("squeeze_head");
    41.    }
    42.    
    43.    // squeeze body
    44.    //else if (Input.GetButton ("Jump") ) {
    45.       //animation.Play("squeeze_body");
    46.    //}    
    47.    // head punch
    48.    //else if (Input.GetButton ("MouseX") ) {
    49.    //else if (Input.GetButton ("Jump") ) {
    50.       //animation.Play("face_punch");
    51.    //}
    52.    
    53.    // bodypunch
    54.    else if (Input.GetButton ("Jump") ) {
    55.       animation.Play("belly_punch");
    56.    }
    57.  
    58.    else {
    59.      animation.CrossFade("idle_breath");
    60.      //animation.Play("idle_breath");
    61.     }
    62.    
    63. }
     
  4. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Erm... this doesn't seem to have anything to do with the DragRigidbody error ;-)

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

    shumno

    Joined:
    Jul 28, 2009
    Posts:
    29
    OK. I jumped the gun. Thanks for pointing it out :) 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!