Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic Rope Grabbing
#1
Hello,

I am trying to set up a basic rope grabbing with a simple box collider. I added ObiContactGrabber to the box collider and a script RopeGrabber.cs which calls Grab() function. When the box collider is in contact with the particles it seems not working. What am I doing wrong ?

Here is the full sample project https://www.dropbox.com/s/a358ydt1gy2qk2...n.rar?dl=0

Thanks 
Eddy
Reply
#2
Hi Eddy,

The link you shared seems to be broken. I get redirected to a page that says "Your file is being uploaded".
Reply
#3
(31-05-2021, 01:02 PM)josemendez Wrote: Hi Eddy,

The link you shared seems to be broken. I get redirected to a page that says "Your file is being uploaded".
Hello Jose,

Sorry, I fixed it now.


Thank you for your help.
Best
Eddy
Reply
#4
Hi Eddy,

Your RopeGrabber script looks like this:

Code:
public class RopeGrabber : MonoBehaviour
{
    // Start is called before the first frame update
    ObiContactGrabber obigrab;
    void Start()
    {
        obigrab.Grab();
    }

    // Update is called once per frame
    void Update()
    {
        obigrab.Grab();
    }
}

Entering play mode results in a NullReferenceException right away, because the "obigrab" variable is null.

"obigrab" is not public (so you can't assign it in the inspector, or change its value from another place) and you're not assigning any value to it at runtime either, so this script can't possibly work. Either make the variable public and assign the ObiContactGrabber to it by dragging the component into the inspector slot, or use GetComponent<T> at runtime to get a reference to the ObiContactGrabber.

Also, calling the Grab() method every frame is probably not a good idea.

I'd advise to get familiar with the basics of Unity and C# programming before using Obi, otherwise you're in for a lot of frustration. Obi is an advanced engine that assumes basic physics and math knowledge (time stepping, vector and matrix algebra, use of forces/accelerations/impulses, etc) as well as intermediate programming skills.

cheers!
Reply
#5
Hi

Problem fixed. Thanks

Cheers
Eddy
Reply