14-02-2019, 12:55 PM
(This post was last modified: 14-02-2019, 12:56 PM by josemendez.)
(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