Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Object w/ Rigidbody Movement + Pinned Rope
#1
Triste 
My problem is a bit unique but ill break it down with gifs/pics.

Physics movement w/ Rigidbody + Obi Solver updating "After Fixed Update":[Image: TCiNLTc.gif]

Same thing but solver being updated at FixedUpdate:
[Image: L6N5jZz.gif]

Theres a clear delay in positioning and its obvious it deals with the physics orders these both are executing at but this is where my problem gets unique.

I want to attach a Transform to the ends of each of the arms and they would act like hands for interacting with items like so:
[Image: yO9g76x.gif]

That was an old iteration of the project and its moving the transform.position of the balloon for movement, not rigidbody physics.

This is it with the solver updating on FixedUpdate (works like intended BUT would have physics position delay between the rope and balloon):
[Image: htld8tv.gif]

This is what happens when i attach hands when solver is not updating in FixedUpdate (This would give desired balloon movement [no delay with the rope] but my hands method wont work):
[Image: GRbXYj5.gif]

I get this effect by adding a pin constraint from end particle of LeftArm to the LeftHand object that has a collider/rigidbody/obi collider/obi rigidbody and the mass is pretty low. Its main purpose is just to let me control the end of the arm when the player goes to interact with something.
[Image: 24eb0681a6a8645d10a44da722572200.png]

So im in this situation where this project needs physics movement to match the theme (with rigidbody) but cant do that if i want to create hand objects.

Is there another way of doing this or maybe a work around because my end goal is to control the end of the arm ropes to interact with objects but cant have that delay between rope and balloon while moving.
Reply
#2
(12-04-2019, 04:36 AM)VirtualCucumber Wrote: My problem is a bit unique but ill break it down with gifs/pics.

Physics movement w/ Rigidbody + Obi Solver updating "After Fixed Update":[Image: TCiNLTc.gif]

Same thing but solver being updated at FixedUpdate:
[Image: L6N5jZz.gif]

Theres a clear delay in positioning and its obvious it deals with the physics orders these both are executing at but this is where my problem gets unique.

I want to attach a Transform to the ends of each of the arms and they would act like hands for interacting with items  like so:
[Image: yO9g76x.gif]

That was an old iteration of the project and its moving the transform.position of the balloon for movement, not rigidbody physics.

This is it with the solver updating on FixedUpdate (works like intended BUT would have physics position delay between the rope and balloon):
[Image: htld8tv.gif]

This is what happens when i attach hands when solver is not updating in FixedUpdate (This would give desired balloon movement [no delay with the rope] but my hands method wont work):
[Image: GRbXYj5.gif]

I get this effect by adding a pin constraint from end particle of LeftArm to the LeftHand object that has a collider/rigidbody/obi collider/obi rigidbody and the mass is pretty low. Its main purpose is just to let me control the end of the arm when the player goes to interact with something.
[Image: 24eb0681a6a8645d10a44da722572200.png]

So im in this situation where this project needs physics movement to match the theme (with rigidbody) but cant do that if i want to create hand objects.

Is there another way of doing this or maybe a work around because my end goal is to control the end of the arm ropes to interact with objects but cant have that delay between rope and balloon while moving.

Hi,

Delays are generally caused by updating things in the wrong order, for instance if your script changes the rigidbody position after simulation has taken place for that frame, there will be a 1-frame delay between the rope and your object.

Why not setting particle positions/velocities directly to control the hands? See:
http://obi.virtualmethodstudio.com/tutor...icles.html
Reply
#3
(12-04-2019, 07:10 AM)josemendez Wrote: Hi,

Delays are generally caused by updating things in the wrong order, for instance if your script changes the rigidbody position after simulation has taken place for that frame, there will be a 1-frame delay between the rope and your object.

Why not setting particle positions/velocities directly to control the hands? See:
http://obi.virtualmethodstudio.com/tutor...icles.html

How naive of me not to check the docs for scripting particles Indeciso 


Code:
   public virtual IEnumerator Interact(BalloonController balloon)
   {
       var previousMass = balloon.solver.invMasses[0];

       while (Mathf.Abs(Vector3.Distance(transform.position, balloon.solver.positions[0])) > 0.1f)
       {
           balloon.solver.invMasses[0] = 0;
           balloon.solver.positions[0] = Vector3.Lerp(balloon.solver.positions[0], transform.position, grabSmoothing * Time.deltaTime);

           yield return new WaitForFixedUpdate();
       }

       balloon.solver.invMasses[0] = previousMass;
   }


Runs very nice now, thank you for the fast reply Corazón
Reply