Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Grappling Hook Implementation
#1
Hello, first off, I want to say how impressed I am with Obi Rope's performance, stability, and looks. You're doing a great job!

So I'm *attempting* to use it in a less traditional fashion to create something similar to a Grappling Hook Gun. The player fires a projectile which attaches to other objects in the scene, and the player then swings around (in 3D) using Obi Rope rigid body physics.

I'm currently stuck at even getting the projectile to fire from the "gun" with the rope attached to behave properly. I've pinned the ends of the rope to the projectile (rigidbody) and the player (rigidbody) and added a cursor to the players side.

I've done basically what's in the code below and was hoping it would do the trick, but the projectile seems to just spring back and act unpredictably. Not to mention the cursor length extension doesn't seem to keep up when used this way.

Code:
bool fired = false;

void Fire()
{
  fired = true;
  // Add force to projectile's rigidbody
}

void FixedUpdate()
{
   if(fired)
     cursor.ChangeLength((gunBarrel.position - projectile.position).magnitude);
}
Before using a fired projectile, I had used similar code to create a dynamic length rope between two objects that I moved by hand in the editor and it seemed to work well enough.
Any tips on how I should go about implementing this?
Reply
#2
(25-12-2017, 06:25 AM)Cyric Wrote: Hello, first off, I want to say how impressed I am with Obi Rope's performance, stability, and looks. You're doing a great job!

So I'm *attempting* to use it in a less traditional fashion to create something similar to a Grappling Hook Gun. The player fires a projectile which attaches to other objects in the scene, and the player then swings around (in 3D) using Obi Rope rigid body physics.

I'm currently stuck at even getting the projectile to fire from the "gun" with the rope attached to behave properly. I've pinned the ends of the rope to the projectile (rigidbody) and the player (rigidbody) and added a cursor to the players side.

I've done basically what's in the code below and was hoping it would do the trick, but the projectile seems to just spring back and act unpredictably. Not to mention the cursor length extension doesn't seem to keep up when used this way.

Code:
bool fired = false;

void Fire()
{
  fired = true;
  // Add force to projectile's rigidbody
}

void FixedUpdate()
{
   if(fired)
     cursor.ChangeLength((gunBarrel.position - projectile.position).magnitude);
}
Before using a fired projectile, I had used similar code to create a dynamic length rope between two objects that I moved by hand in the editor and it seemed to work well enough.
Any tips on how I should go about implementing this?
[quote pid='854' dateline='1514179532']
I'm also trying to implement this. ie the rope will extend from the gun (source) and hook into the wall in 0.25 seconds

Did you happen to find the way ? 
[/quote]
Reply