Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ai.fluctio.fluctio-sim / Core / Components / MujocoGeom / MujocoStructure.cs
Size: Mime:
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};
	}
}