Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  how to remove fixed state
#21
(14-02-2019, 12:47 PM)Richard Wrote: I want it be static.

I tried code, but many errors happen.


"Assets\InverseParticles.cs(15,33): error CS0029: Cannot implicitly convert type 'string' to 'UnityEngine.GameObject'"

"Assets\InverseParticles.cs(18,40): error CS1061: 'GameObject' does not contain a definition for 'invMasses' and no accessible extension method 'invMasses' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)"

"Assets\InverseParticles.cs(20,44): error CS1061: 'GameObject' does not contain a definition for 'particleIndices' and no accessible extension method 'particleIndices' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)"

"Assets\InverseParticles.cs(21,24): error CS1061: 'GameObject' does not contain a definition for 'invMasses' and no accessible extension method 'invMasses' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)"

"Assets\InverseParticles.cs(21,39): error CS0103: The name 'solver' does not exist in the current context"


I can't solve the problem. I thought "actor" in your code is to get name of  object of mesh. However, string causes error. 
In addition to that, I cannot what to do for "solver", or am I wrong how to think the problems?


The code is the image.

Hi,

That code does not make sense at all.

- You're assigning a string to a variable of type GameObject. The name of an object is not the object itself.
- "actor" must be an ObiActor component, not a GameObject.
- "solver" must be declared somewhere in your script, and must be of type ObiSolver. You can make it a public variable and assign it in the inspector, or grab it from the actor itself.

Imho, before trying to use advanced stuff like cloth simulation, you should first study the elemental stuff: how to write C# and how to use Unity. I cannot hand-hold you trough such basic coding issues.

Here's some resources on the topic:
https://unity3d.com/es/learn/tutorials/s/scripting
Reply
#22
(14-02-2019, 12:55 PM)josemendez Wrote: Hi,

That code does not make sense at all.

- You're assigning a string to a variable of type GameObject. The name of an object is not the object itself.
- "actor" must be an ObiActor component, not a GameObject.
- "solver" must be declared somewhere in your script, and must be of type ObiSolver. You can make it a public variable and assign it in the inspector, or grab it from the actor itself.

Imho, before trying to use advanced stuff like cloth simulation, you should first study the elemental stuff: how to write C# and how to use Unity. I cannot hand-hold you trough such basic coding issues.

Here's some resources on the topic:
https://unity3d.com/es/learn/tutorials/s/scripting

It is not imho. I learned some, but not enough. I should study basic and after ask you. Thank you. I check tutorial for what I do not have now.
Reply
#23
(14-02-2019, 01:03 PM)Richard Wrote: It is not imho. I learned some, but not enough. I should study basic and after ask you. Thank you. I check tutorial for what I do not have now.

Hello. I learned a little. 

In the website(http://obi.virtualmethodstudio.com/tutor...icles.html), I think you do not declare "solver". How did you declare in that script?
Reply
#24
(14-02-2019, 04:05 PM)Richard Wrote: Hello. I learned a little. 

In the website(http://obi.virtualmethodstudio.com/tutor...icles.html), I think you do not declare "solver". How did you declare in that script?

Hi there,

The code in most snippets assumes the solver/actor are already declared. Unless the sample code is an entire script, it is assumed these variables come from your own code.

There's many ways to get a reference to a solver. If you already have an actor, you can obtain the solver that manages it:

Code:
ObiSolver solver = actor.Solver;

You can also declare a public variable in your script, and fill the reference from Unity's inspector:

Code:
public class YourScript : MonoBehaviour
{
public ObiSolver solver;

//.... rest of your code...
}

That's just two possibilities. Being a variable, you can declare a variable of type ObiSolver anywhere in your code and fill it from anywhere you want. As long as you respect C#'s syntax, that is.
Reply
#25
(14-02-2019, 04:18 PM)josemendez Wrote: Hi there,

The code in most snippets assumes the solver/actor are already declared. Unless the sample code is an entire script, it is assumed these variables come from your own code.

There's many ways to get a reference to a solver. If you already have an actor, you can obtain the solver that manages it:

Code:
ObiSolver solver = actor.Solver;

You can also declare a public variable in your script, and fill the reference from Unity's inspector:

Code:
public class YourScript : MonoBehaviour
{
public ObiSolver solver;

//.... rest of your code...
}

That's just two possibilities. Being a variable, you can declare a variable of type ObiSolver anywhere in your code and fill it from anywhere you want. As long as you respect C#'s syntax, that is.
Hello.
I really appreciate your hints. I think I could make one. Is it perfect?
Reply