Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  how to make obi cloth on script
#1
I am trying to make obi cloth on script. I saw scripting Actors of user manual.

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;

public class SetupCloth : MonoBehaviour
{
   GameObject obj;

   ObiActor actor;
   public ObiSolver solver;
   
   void Start()
   {
       obj = GameObject.Find("cloth");
       Mesh mesh = obj.GetComponent<MeshFilter>().sharedMesh;

       GameObject clothObject = new GameObject("cloth", typeof(ObiSolver),typeof(ObiCloth));

       // get references to all components:
       ObiCloth cloth = clothObject.GetComponent();
       ObiSolver solver = clothObject.GetComponent();

       // generate the topology:
       ObiMeshTopology topology = ScriptableObject.CreateInstance(sourceTopology);
       topology.InputMesh = mesh;
       topology.Generate();

       // set the cloth topology and solver:
       cloth.Solver = solver;
       cloth.SharedTopology = topology;
   }

}
What is wrong with that? I had three errors.

Assets\SetupCloth.cs(21,38): error CS0411: The type arguments for method 'GameObject.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Assets\SetupCloth.cs(22,40): error CS0411: The type arguments for method 'GameObject.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Assets\SetupCloth.cs(25,68): error CS0103: The name 'sourceTopology' does not exist in the current context
Reply


Messages In This Thread
how to make obi cloth on script - by Richard - 30-05-2019, 12:51 AM
RE: how to make obi cloth on script - by Richard - 30-05-2019, 10:24 AM
RE: how to make obi cloth on script - by Richard - 30-05-2019, 11:26 AM
RE: how to make obi cloth on script - by Richard - 30-05-2019, 12:36 PM
RE: how to make obi cloth on script - by Richard - 30-05-2019, 03:45 PM
RE: how to make obi cloth on script - by Richard - 30-05-2019, 06:28 PM