Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Creating a bungee jumping rope
#1
Pregunta 
Hi everyone! I'm new with the ObiRope, and not an advanced-level game developer. 

Here is my case:
I am working on a bungee jumping game.
I've created my scene(character, platform, ObiRope, RopeBlueprint, ObiSolver, etc.) and copied the settings from the Crane sample.
Connections and rope work, but not in the way I want.
There will be 2 variables in each game level (Weight of the character and height of the platform).
According to those 2, the rope length (at the beginning) will change.

My Issues:
- When I set the rope length by using "cursor.ChangeLength", it sets if the stretching scale is 1. But in that case, the rope seems to be stretched, but it is not in the way as it is in the crane.
- If I set the stretching scale lower than 1, the rope gets shortened and I can no longer set the rope value to the value I want.
- I am trying to apply the formula I prepared for elongation and shortening. What should I do to achieve that? If it's possible with the current settings that are available on Inspector, I would try to find the best option. But, when I find a solution for a specific character weight and rope length, it doesn't apply to all the variables I have in the project. 
- Also, when the rope reaches the maximum elongation point (or I think I can say the maximum restLenght) and starts getting back, the character nearly gets to the point where it started to drop. So, I want to edit vertical damping as well. 

If you could help me with those issues, I would be so happy. Thank you so much in advance! Sonrisa
Reply
#2
(27-08-2022, 09:32 PM)HazarS Wrote: - When I set the rope length by using "cursor.ChangeLength", it sets if the stretching scale is 1. But in that case, the rope seems to be stretched, but it is not in the way as it is in the crane.

Stretching scale must be set to 1 unless you want to make distance constraints shorter. What do you mean by "the rope seems to be stretched, but it is not in the way as it is in the crane."?

(27-08-2022, 09:32 PM)HazarS Wrote: - If I set the stretching scale lower than 1, the rope gets shortened and I can no longer set the rope value to the value I want.

Yes, that's the expected behavior: the stretching scale parameter scales the length of the rope, if you set it to say 0.5, the rope will be 50% shorter than its rest length. So if you set its rest length to 5 meters using cursor.ChangeLength(), its length will be set to 5*0.5 = 2.5.

(27-08-2022, 09:32 PM)HazarS Wrote: - I am trying to apply the formula I prepared for elongation and shortening. What should I do to achieve that?

Well, it depends on what your formula looks like and what it does. Could you explain what you're trying to do in more detail?

(27-08-2022, 09:32 PM)HazarS Wrote: If it's possible with the current settings that are available on Inspector, I would try to find the best option. But, when I find a solution for a specific character weight and rope length, it doesn't apply to all the variables I have in the project. 

What do you mean by "it doesn't apply to all the variables in the project"?

(27-08-2022, 09:32 PM)HazarS Wrote: - Also, when the rope reaches the maximum elongation point (or I think I can say the maximum restLenght) and starts getting back, the character nearly gets to the point where it started to drop. So, I want to edit vertical damping as well. 

With zero or little damping, that's what should happen. You can increase damping in the ObiSolver component. Note this damping value is isotropic (acts with the same strength in all directions), if you're interested in a vertical damping only you will have to implement it yourself. You can get/set/edit all particle properties using the particles API, so it should be easy to apply your own damping calculations if needed.

kind regards,
Reply
#3
(29-08-2022, 09:16 AM)josemendez Wrote: Stretching scale must be set to 1 unless you want to make distance constraints shorter. What do you mean by "the rope seems to be stretched, but it is not in the way as it is in the crane."?


Yes, that's the expected behavior: the stretching scale parameter scales the length of the rope, if you set it to say 0.5, the rope will be 50% shorter than its rest length. So if you set its rest length to 5 meters using cursor.ChangeLength(), its length will be set to 5*0.5 = 2.5.


Well, it depends on what your formula looks like and what it does. Could you explain what you're trying to do in more detail?


What do you mean by "it doesn't apply to all the variables in the project"?


With zero or little damping, that's what should happen. You can increase damping in the ObiSolver component. Note this damping value is isotropic (acts with the same strength in all directions), if you're interested in a vertical damping only you will have to implement it yourself. You can get/set/edit all particle properties using the particles API, so it should be easy to apply your own damping calculations if needed.

kind regards,


Thank you very much for your swift and helpful response, and sorry for my language (I'm not a native English speaker Sonrisa ) 

I will go over all the questions one by one, 
1) I meant its starting length.
2) I meant since the character weight and platform height will be set randomly, the rope's starting and stretched length should be as it is expected for all the possible weight-height combinations. 

Also, sorry for not updating my post, I solved the issues (or the questions let's say, because they're not issues since that was because of my lack of experience with the Obi Rope Sonrisa )

But now I have another question. I'm placing the rope in different positions (just the position.y changes randomly). However, the path doesn't change and it creates some problems as you can imagine because the path stays at the same position that I placed it in the scene view. Could you please help me with that?
Reply
#4
Hi!

(29-08-2022, 01:46 PM)HazarS Wrote: I meant since the character weight and platform height will be set randomly, the rope's starting and stretched length should be as it is expected for all the possible weight-height combinations. 

I don't quite get why you're changing the rope's rest length using a cursor then. Bungee coords have a fixed rest length (that is, if you measure the rope without stretching it). The rope will stretch a different amount depending on platform height and character weight, as well as the rope's compliance (elasticity). This is automatically simulated by Obi, you don't need to do any special calculations on your part for this to happen.

If you hang an object from a rope, the rope will stretch more or less depending on the difference in mass between the object and the rope. This is also affected by the object's falling speed.

(29-08-2022, 01:46 PM)HazarS Wrote: But now I have another question. I'm placing the rope in different positions (just the position.y changes randomly). However, the path doesn't change and it creates some problems as you can imagine because the path stays at the same position that I placed it in the scene view. Could you please help me with that?

The blueprint path is just an asset that determines the rope's initial shape and length, it does not have a position/orientation in the scene. At runtime, the rope is instantiated at its transform's position and rotation, once it's instantiated it will move independently from the transform (for an obvious reason: a transform determines a single position/orientation in space, but different parts of a rope can be at different positions / orientations so it can't be expressed as a single transform).

So you have two options: either instantiate the rope after setting its transform, or use rope.Teleport() to teleport the entire rope to a new location after instantiating it.
Reply
#5
(29-08-2022, 03:58 PM)josemendez Wrote: I don't quite get why you're changing the rope's rest length using a cursor then. Bungee coords have a fixed rest length (that is, if you measure the rope without stretching it). The rope will stretch a different amount depending on platform height and character weight, as well as the rope's compliance (elasticity). This is automatically simulated by Obi, you don't need to do any special calculations on your part for this to happen.

If you hang an object from a rope, the rope will stretch more or less depending on the difference in mass between the object and the rope. This is also affected by the object's falling speed.

Depending on the platform height and character weight, players will be choosing a rope length. This is something related to successfully completing the level and getting high score. 


Quote:The blueprint path is just an asset that determines the rope's initial shape and length, it does not have a position/orientation in the scene. At runtime, the rope is instantiated at its transform's position and rotation, once it's instantiated it will move independently from the transform (for an obvious reason: a transform determines a single position/orientation in space, but different parts of a rope can be at different positions / orientations so it can't be expressed as a single transform).

So you have two options: either instantiate the rope after setting its transform, or use rope.Teleport() to teleport the entire rope to a new location after instantiating it.


Thank you so much for the help! rope.Teleport() worked very well for me! No issues with the location Sonrisa  Corazón
Reply
#6
(30-08-2022, 01:34 PM)HazarS Wrote: Depending on the platform height and character weight, players will be choosing a rope length. This is something related to successfully completing the level and getting high score. 

Then it's probably easier to create a rope of the given length, instead of changing the length of an existing rope. You can create rope blueprints at runtime, and set the control points to create a rope of any initial shape and length. See: http://obi.virtualmethodstudio.com/manua...ctors.html

(30-08-2022, 01:34 PM)HazarS Wrote: Thank you so much for the help! rope.Teleport() worked very well for me! No issues with the location Sonrisa  Corazón

You're welcome! let me know if you need further help Sonrisa
Reply