Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Fishing Pole/Line
#2
(15-04-2022, 12:57 AM)Natty Wrote: Hi All,

Just grabbed Obi Rope and played around with some tutorials and overall got a feel for it.  This tool is amazing.  Definitely worth the purchase, and I will be leaving a review shortly once I get more comfortable with it.

I am trying to implement a fishing pole; to be specific, the fishing line on a fishing pole and casting it out, with the option of reeling it in.  To begin, I'm focusing first on being able to cast it out.  I've created a pole and attached a rope to the pole, and a bobber (just a Unity sphere) to the end of it and added a Rigidbody component to it. My idea is to eventually have an animation play for the player slowly bringing back the rod to then release it forward and cast out.

Currently my fishing system is set up without any animations, but it works by applying a force to the bobber's rigidbody, depending on how long the player holds the button to essentially wind-up a cast.  As it is now, when the player let's go of the cast button the following code is triggered:

Code:
        bobberGO.transform.position = transform.position + yOffset;
        rb.velocity = transform.TransformDirection(10f * fishingCastScrollBarValue * randomPosition);

Which is just setting the bobber at a position of where it would be released, and then applying the physics to the bobber.

Where Obi Rope comes in is that I would like the rope to always start off with a length of where the rope is just hanging from the pole a bit, and then when the player casts out it dynamically resizes until the bobber hits the water.  I currently don't have a system in place to reel in the rope and instead when the player catches a fish or is done fishing, I would just like the rope to be set back to it's original length of hanging from the pole.

Admittedly, I need more time and practice with Obi Rope, but I was hoping someone could point me in the right direction.  I have found resources for ObiRopeCursor, and the tutorials on YouTube, but I'm struggling a bit to get something cohesive working.

Thank you.

Hi!

Calling the ObiRopeCursor’s ChangeLength() method would be the way to go. Initially you want to set it to the length between the tip of the rod and the bobber (might be a fixed distance that you specify) and when the player casts it out, set it to the *measured* (using Vector3.Distance) distance between the tip of the rod and the bobber, plus some extra headroom if you want. That should do it.

Let me know if i can be of further help. Kind regards,
Reply


Messages In This Thread
Fishing Pole/Line - by Natty - 15-04-2022, 12:57 AM
RE: Fishing Pole/Line - by josemendez - 15-04-2022, 09:17 AM
RE: Fishing Pole/Line - by Natty - 17-04-2022, 06:22 PM
RE: Fishing Pole/Line - by josemendez - 18-04-2022, 09:38 AM
RE: Fishing Pole/Line - by Natty - 19-04-2022, 02:56 PM
RE: Fishing Pole/Line - by josemendez - 20-04-2022, 08:47 AM
RE: Fishing Pole/Line - by Natty - 21-04-2022, 01:26 AM
RE: Fishing Pole/Line - by Natty - 26-04-2022, 05:44 PM
RE: Fishing Pole/Line - by josemendez - 27-04-2022, 07:56 AM
RE: Fishing Pole/Line - by Natty - 29-04-2022, 07:13 PM
RE: Fishing Pole/Line - by josemendez - 30-04-2022, 09:40 AM
RE: Fishing Pole/Line - by Natty - 30-04-2022, 04:47 PM
RE: Fishing Pole/Line - by josemendez - 30-04-2022, 05:38 PM
RE: Fishing Pole/Line - by Natty - 30-04-2022, 11:07 PM
RE: Fishing Pole/Line - by josemendez - 01-05-2022, 12:24 AM
RE: Fishing Pole/Line - by Natty - 01-05-2022, 03:40 AM
RE: Fishing Pole/Line - by josemendez - 02-05-2022, 08:54 AM
RE: Fishing Pole/Line - by Natty - 03-05-2022, 06:15 PM
RE: Fishing Pole/Line - by Natty - 25-05-2022, 12:39 AM
RE: Fishing Pole/Line - by josemendez - 25-05-2022, 01:23 PM
RE: Fishing Pole/Line - by Natty - 25-05-2022, 05:25 PM
RE: Fishing Pole/Line - by Natty - 04-06-2022, 09:08 PM
RE: Fishing Pole/Line - by josemendez - 06-06-2022, 07:45 AM
RE: Fishing Pole/Line - by Natty - 10-06-2022, 12:03 AM
RE: Fishing Pole/Line - by josemendez - 13-06-2022, 11:49 AM
RE: Fishing Pole/Line - by Natty - 22-06-2022, 03:11 AM
RE: Fishing Pole/Line - by josemendez - 22-06-2022, 08:32 AM
RE: Fishing Pole/Line - by Natty - 23-06-2022, 02:42 AM
RE: Fishing Pole/Line - by Natty - 28-06-2022, 01:15 AM