Repository URL to install this package:
Version:
1.0.0 ▾
|
using System.Collections.Generic;
using Fluctio.FluctioSim.Core.Components.Base;
using Mujoco;
using UnityEngine;
namespace Fluctio.FluctioSim.Core.Components.MujocoGeom
{
[DisallowMultipleComponent]
[DefaultExecutionOrder(-10)] // many components use this one, so this should load first
public abstract class MujocoStructure : InternalsEditorComponent
{
[field: SerializeField, HideInInspector] public MjBody BodyComponent { get; private set; }
[field: SerializeField, HideInInspector] public GameObject GeomObject { get; private set; }
[field: SerializeField, HideInInspector] public MjGeom GeomComponent { get; private set; }
protected override void InitializeOnce()
{
base.InitializeOnce();
BodyComponent = gameObject.AddComponent<MjBody>();
GeomObject = new GameObject("Geom");
GeomObject.transform.SetParent(transform);
GeomComponent = GeomObject.AddComponent<MjGeom>();
}
protected override IEnumerable<GameObject> GetInternalObjects() => new[] {GeomObject};
protected override IEnumerable<MonoBehaviour> GetInternalComponents() => new[] {BodyComponent};
protected override IEnumerable<Object> GetCreatedInternals() => new Object[] {GeomObject, BodyComponent};
}
}