Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  how to remove fixed state
#1
Are there some ways to delete or remove all pin constraints and fixed state in the play or on script?
Reply
#2
(14-02-2019, 02:43 AM)Richard Wrote: Are there some ways to delete or remove all pin constraints and fixed state in the play or on script?

Yes, select all fixed particles and click "unfix" button in the particle editor, or select all pinned particles and click "Remove selected" in the PinConstraints inspector.
Reply
#3
(14-02-2019, 08:11 AM)josemendez Wrote: Yes, select all fixed particles and click "unfix" button in the particle editor, or select all pinned particles and click "Remove selected" in the PinConstraints inspector.
 Can I do that at runtime not using any buttons?
Reply
#4
(14-02-2019, 08:38 AM)Richard Wrote:  Can I do that at runtime not using any buttons?

Yes. Simply set the desired inverse mass values in case of fixed particles (0 for a fixed particle, any positive value for a non-fixed particle):
http://obi.virtualmethodstudio.com/tutor...icles.html

In case of pin constraints, just use the API to remove them:
http://obi.virtualmethodstudio.com/tutor...aints.html
Reply
#5
(14-02-2019, 08:52 AM)josemendez Wrote: Yes. Simply set the desired inverse mass values in case of fixed particles (0 for a fixed particle, any positive value for a non-fixed particle):
http://obi.virtualmethodstudio.com/tutor...icles.html

In case of pin constraints, just use the API to remove them:
http://obi.virtualmethodstudio.com/tutor...aints.html

I copied code like the image and added. Some two errors happened."Assets\AddConstraints.cs(14,50): error CS0411: The type arguments for method 'Component.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly." and "Assets\AddConstraints.cs(15,76): error CS0021: Cannot apply indexing with [] to an expression of type 'IEnumerable<ObiConstraintBatch>'". How can I solve the errors.

(14-02-2019, 09:12 AM)Richard Wrote: I copied code like the image and added. Some two errors happened."Assets\AddConstraints.cs(14,50): error CS0411: The type arguments for method 'Component.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly." and "Assets\AddConstraints.cs(15,76): error CS0021: Cannot apply indexing with [] to an expression of type 'IEnumerable<ObiConstraintBatch>'". How can I solve the errors.
Reply
#6
(14-02-2019, 09:12 AM)Richard Wrote: I copied code like the image and added. Some two errors happened."Assets\AddConstraints.cs(14,50): error CS0411: The type arguments for method 'Component.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly." and "Assets\AddConstraints.cs(15,76): error CS0021: Cannot apply indexing with [] to an expression of type 'IEnumerable<ObiConstraintBatch>'". How can I solve the errors.


Hi,

Sorry, the < and > signs weren't rendering properly in the page. We've corrected it. The code should be:

Code:
ObiDistanceConstraints constraints = GetComponent<ObiDistanceConstraints>();
     ObiDistanceConstraintBatch batch = (ObiDistanceConstraintBatch)constraints.GetFirstBatch();
Reply
#7
(14-02-2019, 09:19 AM)josemendez Wrote: Hi,

Sorry, the < and > signs weren't rendering properly in the page. We've corrected it. The code should be:

Code:
ObiDistanceConstraints constraints = GetComponent<ObiDistanceConstraints>();
     ObiDistanceConstraintBatch batch = (ObiDistanceConstraintBatch)constraints.GetFirstBatch();

If I use fix translation that is in edit particle, can I unfix that without any button at runtime?
Reply
#8
(14-02-2019, 10:04 AM)Richard Wrote: If I use fix translation that is in edit particle, can I unfix that without any button at runtime?

Yes. As I explained, set the desired inverse mass values in case of fixed particles (0 for a fixed particle, any positive value for a non-fixed particle). How to set per-particle properties is explained here:
http://obi.virtualmethodstudio.com/tutor...icles.html
Reply
#9
(14-02-2019, 10:28 AM)josemendez Wrote: Yes. As I explained, set the desired inverse mass values in case of fixed particles (0 for a fixed particle, any positive value for a non-fixed particle). How to set per-particle properties is explained here:
http://obi.virtualmethodstudio.com/tutor...icles.html
I tried the other way, but it did not work like the image. What is wrong?
Reply
#10
(14-02-2019, 10:32 AM)Richard Wrote: I tried the other way, but it did not work like the image. What is wrong?

Hi,

What do you mean "the other way"?

Honestly I don't know what your use case is, but adding that many pin constraints for a dress just doesn't make sense to me. Why'd you want to do that? Pin constraints are used to enable two-way coupling with rigidbodies... looks like you'd want to use either fixed particles or skin constraints, if you're trying to create character clothing. Also having a mesh collider for a deformable object doesn't make sense, specially when Obi has built-in collision detection for cloth.
Reply