23-12-2020, 02:42 PM
Hi there,
Works fine for me, using the exact same code you posted:
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);
}
}
}