Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  problem of particle position
#2
Hi there,

Works fine for me, using the exact same code you posted:

Code:
using UnityEngine;
using Obi;

[RequireComponent(typeof(ObiActor))]
public class GetCPPosition : MonoBehaviour
{
    ObiActor actor;
    public int cpIndex = 0;

    void Start()
    {
        actor = GetComponent<ObiActor>();
    }

    private void OnValidate()
    {
        cpIndex = Mathf.Max(0, cpIndex);
    }

    void OnDrawGizmos()
    {
        if (actor != null &&
            actor.blueprint != null &&
            actor.blueprint.groups.Count > cpIndex &&
            actor.blueprint.groups[cpIndex].particleIndices.Count > 0)
        {
            int actorIndex = actor.blueprint.groups[cpIndex].particleIndices[0];
            int solverIndex = actor.solverIndices[actorIndex];
            Gizmos.DrawSphere(actor.GetParticlePosition(solverIndex), 0.5f);
        }
    }
}
Reply


Messages In This Thread
problem of particle position - by FZMv587 - 23-12-2020, 02:11 PM
RE: problem of particle position - by josemendez - 23-12-2020, 02:42 PM
RE: problem of particle position - by FZMv587 - 23-12-2020, 03:04 PM
RE: problem of particle position - by josemendez - 23-12-2020, 04:38 PM