Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Reposition in script and setup
#1
Triste 
[attachment=549]

I have object that need a rope to hook a load to move. I have to have the red circle in different position too.

In A,

If I change the position of the red circle, sometimes the rope stays there hanging the load. Is there anyway to update/reset, so it definitely follow the red circle? There are other time where it does follow, but the rope is swinging a lot. Is there any function to call that stop the swinging? It is just for a reset only.

In B,

If I have both of the them being fixed, the load just drops immediately, I don't know which way is the right way to set the joints up. Any suggestion?

Thanks.
Reply
#2
(13-12-2019, 10:58 AM)LORDeveloper Wrote: I have object that need a rope to hook a load to move. I have to have the red circle in different position too.

In A,

If I change the position of the red circle, sometimes the rope stays there hanging the load. Is there anyway to update/reset, so it definitely follow the red circle? There are other time where it does follow, but the rope is swinging a lot. Is there any function to call that stop the swinging? It is just for a reset only.

In B,

If I have both of the them being fixed, the load just drops immediately, I don't know which way is the right way to set the joints up. Any suggestion?

Thanks.

Assuming you're using Obi 5.0: Attach the rope to the red circle using a static attachment, and attach it to the box using a dynamic attachment (since you need two-way coupling between the blue box and the rope!)

Also, make sure you move the circle during FixedUpdate(), or you'll experience a 1-frame delay. Physics are always (expect in special cases) updated in FixedUpdate(), not Update() or LateUpdate().

To make the rope swing less, increase the solver's damping.
Reply
#3
(13-12-2019, 11:16 AM)josemendez Wrote: Assuming you're using Obi 5.0: Attach the rope to the red circle using a static attachment, and attach it to the box using a dynamic attachment (since you need two-way coupling between the blue box and the rope!)

Also, make sure you move the circle during FixedUpdate(), or you'll experience a 1-frame delay. Physics are always (expect in special cases) updated in FixedUpdate(), not Update() or LateUpdate().

To make the rope swing less, increase the solver's damping.

Does it have to be updating position in FixedUpdate function, because I am doing reset function where I was hoping I can do something like transform.position = Vector.Zero. And that reset its position and everything, otherwise player will need to wait for the object to move.
Reply
#4
(13-12-2019, 12:06 PM)LORDeveloper Wrote: Does it have to be updating position in FixedUpdate function, because I am doing reset function where I was hoping I can do something like transform.position = Vector.Zero. And that reset its position and everything, otherwise player will need to wait for the object to move.

Oh, I misunderstood. So what you want to do is teleport the entire thing to a new position.

Easiest way is to have everything (circle, rope and box) parented under the solver. Then, simply move the solver around anytime you like.
Reply
#5
(13-12-2019, 12:08 PM)josemendez Wrote: Oh, I misunderstood. So what you want to do is teleport the entire thing to a new position.

Easiest way is to have everything (circle, rope and box) parented under the solver. Then, simply move the solver around anytime you like.

Hi, I set it up like you were told. But the load ended up swinging itself miles away.
Reply
#6
(13-12-2019, 12:31 PM)LORDeveloper Wrote: Hi, I set it up like you were told. But the load ended up swinging itself miles away.

Shouldn't, if the setup is correct: both objects and the rope under the solver. Here's a video:
Reply
#7
(13-12-2019, 12:55 PM)josemendez Wrote: Shouldn't, if the setup is correct: both objects and the rope under the solver. Here's a video:


Thanks, I ended up creating a new rope at run time when I do reset. I used your sample script from the rope and hook demo, and it works! However there is a small problem with tangent issue.

[attachment=552]

When I increase the rope length its tangent mode is causing the object getting far away from the rope original point when the box is at an angle. (See blue line)
I want to react like the green line. How can I change it when creating the rope on script?
Reply
#8
(16-12-2019, 04:53 PM)LORDeveloper Wrote: Thanks, I ended up creating a new rope at run time when I do reset. I used your sample script from the rope and hook demo, and it works! However there is a small problem with tangent issue.



When I increase the rope length its tangent mode is causing the object getting far away from the rope original point when the box is at an angle. (See blue line)
I want to react like the green line. How can I change it when creating the rope on script?

Hi! Sorry but I don't understand the problem. Could you post a video?

Also, what do you mean by tangent mode? tangents in the rope spline have to effect whatsoever at runtime, they only determine the initial rope shape.
Reply
#9
(16-12-2019, 05:24 PM)josemendez Wrote: Hi! Sorry but I don't understand the problem. Could you post a video?

Also, what do you mean by tangent mode? tangents in the rope spline have to effect whatsoever at runtime, they only determine the initial rope shape.



As you can see I create the rope at run time using script. And then when I rotate it and extend its length, the rope has a tangent that taking my ball far away.
Reply
#10
(17-12-2019, 10:32 AM)LORDeveloper Wrote:

As you can see I create the rope at run time using script. And then when I rotate it and extend its length, the rope has a tangent that taking my ball far away.

You've probably placed the cursor "source" over a fixed particle (if left at 0, and the first particle is fixed by an attachment, the cursor will generate fixed particles). Place the source elsewhere in the rope, so that it creates regular particles instead.
Reply