27-08-2020, 09:11 PM
Hey,
I've tried to use the code I found on Obi's website to add pressure to my object, but I got the following error message:
Assets/_Scripts/Inflator.cs(24,15): error CS1061: 'ObiCloth' does not contain a definition for 'VolumeConstraints' and no accessible extension method 'VolumeConstraints' accepting a first argument of type 'ObiCloth' could be found (are you missing a using directive or an assembly reference?)
Here is the code:
Many thanks
I've tried to use the code I found on Obi's website to add pressure to my object, but I got the following error message:
Assets/_Scripts/Inflator.cs(24,15): error CS1061: 'ObiCloth' does not contain a definition for 'VolumeConstraints' and no accessible extension method 'VolumeConstraints' accepting a first argument of type 'ObiCloth' could be found (are you missing a using directive or an assembly reference?)
Here is the code:
Code:
using UnityEngine;
using Obi;
[RequireComponent(typeof(ObiCloth))]
public class Inflator : MonoBehaviour {
ObiCloth cloth;
public float inflationSpeed = 0.25f;
public float maxPressure = 2;
// Use this for initialization
void Awake () {
cloth = GetComponent<ObiCloth>();
}
// Update is called once per frame
void Update () {
cloth.VolumeConstraints.overpressure = Mathf.Min(cloth.VolumeConstraints.overpressure +
Time.deltaTime*inflationSpeed,maxPressure);
cloth.VolumeConstraints.PushDataToSolver();
}
}
Many thanks