05-03-2019, 03:50 PM
Hello.
I try to add vector to obi cloth. I have a error:Cannot implicitly convert type 'UnityEngine.Vector3' to 'float', but the direction of coding is not problem?
using UnityEngine;
using System.Collections;
using Obi;
[RequireComponent(typeof(ObiActor))]
public class DistanceAnchor : MonoBehaviour
{
ObiActor actor;
public ObiSolver solver;
void Awake()
{
actor = GetComponent<ObiActor>();
}
void Update()
{
ObiSolver solver = actor.Solver;
float invMassPerParticle = 0.01f;
for (int i = 0; i < actor.invMasses.Length; ++i)
{
int indexInSolver = actor.particleIndices[i];
actor.invMasses[i] = solver.invMasses[indexInSolver];
actor.invMasses[i] = new Vector3(0.0f, 0.05f, 0.0f);
}
}
}
I try to add vector to obi cloth. I have a error:Cannot implicitly convert type 'UnityEngine.Vector3' to 'float', but the direction of coding is not problem?
using UnityEngine;
using System.Collections;
using Obi;
[RequireComponent(typeof(ObiActor))]
public class DistanceAnchor : MonoBehaviour
{
ObiActor actor;
public ObiSolver solver;
void Awake()
{
actor = GetComponent<ObiActor>();
}
void Update()
{
ObiSolver solver = actor.Solver;
float invMassPerParticle = 0.01f;
for (int i = 0; i < actor.invMasses.Length; ++i)
{
int indexInSolver = actor.particleIndices[i];
actor.invMasses[i] = solver.invMasses[indexInSolver];
actor.invMasses[i] = new Vector3(0.0f, 0.05f, 0.0f);
}
}
}