예제 #1
0
    private void PrepCoGMarkers()
    {
        handsMarker = Instantiate(CoGMarkerPrefab);
        handsMarker.Initialize("Hands Marker", Color.black, data.ArmsMassKg);

        shouldersMarker = Instantiate(CoGMarkerPrefab);
        shouldersMarker.Initialize("Shoulder Marker", Color.black, data.ArmsMassKg);

        hipsMarker = Instantiate(CoGMarkerPrefab);
        hipsMarker.Initialize("Hips Marker", Color.black, data.ArmsMassKg);

        toesMarker = Instantiate(CoGMarkerPrefab);
        toesMarker.Initialize("Toes Marker", Color.black, data.ArmsMassKg);



        armsCoGMarker = Instantiate(CoGMarkerPrefab);
        armsCoGMarker.Initialize("Arms CoG", Color.red, data.ArmsMassKg);

        headCoGMarker = Instantiate(CoGMarkerPrefab);
        headCoGMarker.Initialize("Head CoG", Color.white, data.HeadMassKg);

        torsoCoGMarker = Instantiate(CoGMarkerPrefab);
        torsoCoGMarker.Initialize("Torso CoG", Color.blue, data.TorsoMassKg);

        legsCoGMarker = Instantiate(CoGMarkerPrefab);
        legsCoGMarker.Initialize("Legs CoG", Color.yellow, data.LegsMassKg);

        wholeBodyCoGMarker = Instantiate(CoGMarkerPrefab);
        wholeBodyCoGMarker.Initialize("Whole Body CoG", Color.green, data.CombinedMass);

        // bodyCoGMarker = Instantiate(CoGMarkerPrefab);
        // bodyCoGMarker.gameObject.name = "Whole Body CoG";
    }
    // Start is called before the first frame update
    void Start()
    {
        _massPoints = GetComponentsInChildren <MassPoint>().ToList();

        TotalMass = _massPoints.Sum(m => m.mass);
        foreach (MassPoint massPoint in _massPoints)
        {
            massPoint.Initialize(TotalMass);
        }

        centerOfGravityMarker = Instantiate(CoGMarkerPrefab, transform);
        centerOfGravityMarker.Initialize("Center of Gravity", Color.blue, TotalMass);

        subSystemCoGMarker = Instantiate(CoGMarkerPrefab, transform);
        subSystemCoGMarker.Initialize("Legs CoG", Color.magenta, subsystem.Sum(m => m.mass));
    }