Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  harpoon with obi rope
#1
I want to hit the objects with the harpoon with obi rope and then drag those objects with the rope, how can I do that?
Reply
#2
(18-10-2022, 09:11 AM)RuralSculpture Wrote: I want to hit the objects with the harpoon with obi rope and then drag those objects with the rope, how can I do that?

There's an example of this included, see the "RopeGrapplingHook" sample scene. The only difference with a harpoon is that instead of the character being a rigidbody and constrained a pin constraint, it's the object you hit you need to be a rigidbody.

Related links to the manual:
Scripting constraints: http://obi.virtualmethodstudio.com/manua...aints.html
Scripting particles: http://obi.virtualmethodstudio.com/manua...icles.html
Cursors: http://obi.virtualmethodstudio.com/manua...ursor.html

kind regards,
Reply
#3
I tried but I couldn't update it to pull the target object, can you help?
Reply
#4
(18-10-2022, 11:23 AM)RuralSculpture Wrote: I tried but I couldn't update it to pull the target object, can you help?

This should be trivially simple to get to work. What exactly have you tried? can you share your code?

kind regards,
Reply
#5
(18-10-2022, 11:52 AM)josemendez Wrote: This should be trivially simple to get to work. What exactly have you tried? can you share your code?

kind regards,
I'm trying to edit ExtendableGrapplingHook.cs
Reply
#6
(18-10-2022, 11:56 AM)RuralSculpture Wrote: I'm trying to edit ExtendableGrapplingHook.cs

Ok, but what have you tried editing so far? can you share your code? I can't do much to help otherwise, short of writing it for you...
Reply
#7
(18-10-2022, 12:06 PM)josemendez Wrote: Ok, but what have you tried editing so far? can you share your code? I can't do much to help otherwise, short of writing it for you...
I don't want to recreate the universe. I'm just asking how to make the other side dynamic. if i could do that i wouldn't ask. Thanks.
Reply
#8
(18-10-2022, 12:20 PM)RuralSculpture Wrote: I don't want to recreate the universe. I'm just asking how to make the other side dynamic. if i could do that i wouldn't ask. Thanks.

I've already pointed you to the specific example you need to use, and indicated what to do to adapt it: Make sure the object you shoot at is a rigidbody. This isn't something specific to Obi that would require an in-depth explanation, it's a basic Unity skill. If you find that problematic my advice would be to follow some Unity tutorial on gameObjects/components, otherwise you'll keep finding a lot more obstacles in your way.

For instance, in the RopeGrapplingHook scene: select the Cube(4) object, add a Rigidbody component to it, and you're done:

[Image: U8qX5x2.png]

You might optionally want to constrain the rigidbody so that it only moves in 2D if you're going for a 2.5D game, and tweak mass value so that it's easier/harder to pull. Again, nothing specific to Obi: heavier objects are harder to move. Keep in mind that the character also has a mass value, so what matters is the mass ratio between objects just like in the real world: if the character is heavier than the object the harpoon is attached to, it will be easy to pull it, if the object is heavier than the character then it will be hard to pull.

Now, if you're modifying the ExtendableGrapplingHook.cs script, it's not working the way you want, but you refuse to share the modifications you've done so far (so that I can take a look at them and help with any errors/issues) I literally can't do anything to help you.

let me know if you need further help,
Reply
#9
(18-10-2022, 12:44 PM)josemendez Wrote: I've already pointed you to the specific example you need to use, and indicated what to do to adapt it: Make sure the object you shoot at is a rigidbody. This isn't something specific to Obi that would require an in-depth explanation, it's a basic Unity skill. If you find that problematic my advice would be to follow some Unity tutorial on gameObjects/components, otherwise you'll keep finding a lot more obstacles in your way.

For instance, in the RopeGrapplingHook scene: select the Cube(4) object, add a Rigidbody component to it, and you're done:

[Image: U8qX5x2.png]

You might optionally want to constrain the rigidbody so that it only moves in 2D if you're going for a 2.5D game, and tweak mass value so that it's easier/harder to pull. Again, nothing specific to Obi: heavier objects are harder to move. Keep in mind that the character also has a mass value, so what matters is the mass ratio between objects just like in the real world: if the character is heavier than the object the harpoon is attached to, it will be easy to pull it, if the object is heavier than the character then it will be hard to pull.

Now, if you're modifying the ExtendableGrapplingHook.cs script, it's not working the way you want, but you refuse to share the modifications you've done so far (so that I can take a look at them and help with any errors/issues) I literally can't do anything to help you.

let me know if you need further help,

Thanks, I have solved these problems, but when I want to throw it in a direction I want in 3D and paste it on the object, it does not stick. I'm sending raycast on object direction
Reply
#10
(18-10-2022, 03:34 PM)RuralSculpture Wrote: I want to throw it in a direction I want in 3D and paste it on the object, it does not stick. 

I'm sorry, I don't think I understand what you mean: what do you mean by "paste" it on the object? Do you mean you're shooting the grappling hook towards the object and it does not attach itself to the object?

If you want to do this in 3D, the only thing you really need to change is the LaunchHook() method in ExtendableGrapplingHook(). As-is, the raycast direction is a vector lying on the XY plane of the grapple object, which assumes you're working on 2D or 2.5D.

Depending on what exactly you want the user to do to launch the hook, you will want to write different stuff in LaunchHook(). Could you share the code you're currently using to perform the raycast?
Reply