protected override void OnUpdateAxisParameter(BaseAxis axis, UpdateAxisParameters parameter)
        {
            base.OnUpdateAxisParameter(axis, parameter);

            if (jointID != dJointID.Zero)
            {
                if (parameter == UpdateAxisParameters.LimitsEnabled || parameter == UpdateAxisParameters.LimitsRestitution ||
                    parameter == UpdateAxisParameters.LimitsSpring || parameter == UpdateAxisParameters.LimitsDamping ||
                    parameter == UpdateAxisParameters.LimitLow || parameter == UpdateAxisParameters.LimitHigh)
                {
                    ((UniversalAxis)axis).UpdateToLibrary(false);
                }
            }
        }
예제 #2
0
        protected override void OnUpdateAxisParameter(BaseAxis axis, UpdateAxisParameters parameter)
        {
            base.OnUpdateAxisParameter(axis, parameter);

            if (nativeJoint != IntPtr.Zero)
            {
                if (parameter == UpdateAxisParameters.LimitsEnabled || parameter == UpdateAxisParameters.LimitsRestitution ||
                    parameter == UpdateAxisParameters.LimitsSpring || parameter == UpdateAxisParameters.LimitsDamping ||
                    parameter == UpdateAxisParameters.LimitLow || parameter == UpdateAxisParameters.LimitHigh)
                {
                    UpdateLimits();
                }
            }
        }
예제 #3
0
        protected override void OnUpdateAxisParameter( BaseAxis axis, UpdateAxisParameters parameter )
        {
            base.OnUpdateAxisParameter( axis, parameter );

            if( nativeJoint != IntPtr.Zero )
            {
                if( parameter == UpdateAxisParameters.LimitsEnabled || parameter == UpdateAxisParameters.LimitsRestitution ||
                    parameter == UpdateAxisParameters.LimitsSpring || parameter == UpdateAxisParameters.LimitsDamping ||
                    parameter == UpdateAxisParameters.LimitLow || parameter == UpdateAxisParameters.LimitHigh )
                {
                    UpdateLimits();
                }
            }
        }
예제 #4
0
		protected override void OnUpdateAxisParameter( BaseAxis axis, UpdateAxisParameters parameter )
		{
			base.OnUpdateAxisParameter( axis, parameter );

			if( jointID != dJointID.Zero )
			{
				if( parameter == UpdateAxisParameters.LimitsEnabled || parameter == UpdateAxisParameters.LimitsRestitution ||
					parameter == UpdateAxisParameters.LimitsSpring || parameter == UpdateAxisParameters.LimitsDamping ||
					parameter == UpdateAxisParameters.LimitLow || parameter == UpdateAxisParameters.LimitHigh )
				{
					( (HingeAxis)axis ).UpdateToLibrary( false );
				}
			}
		}
예제 #5
0
        //        internal TransformSceneHandle targetEffector;

        public void SetUp()
        {
            initialized = 0;
            int length = joints.Length;

            edges            = new NativeArray <Edge>(length, Allocator.Persistent);
            positions        = new NativeArray <float3>(length, Allocator.Persistent);
            velocities       = new NativeArray <float3>(length, Allocator.Persistent);
            forces           = new NativeArray <float3>(length, Allocator.Persistent);
            masses           = new NativeArray <float>(length, Allocator.Persistent);
            flags            = new NativeArray <int>(length, Allocator.Persistent);
            constraints      = new NativeArray <Constraint>(2, Allocator.Persistent);
            sphereCollisions = new NativeArray <SphereCollision>(1, Allocator.Persistent);


            for (int i = 0; i < sphereCollisions.Length; i++)
            {
                sphereCollisions[i] = new SphereCollision()
                {
                    enabled        = 0,
                    centerPosition = float3.zero,
                    radious        = 0.0f
                };
            }
            for (int i = 0; i < flags.Length; i++)
            {
                flags[i] = 0;
            }
            flags[0]       = 0x8000;
            constraints[0] = new Constraint()
            {
                pointIndex    = 0,
                fixedPosition = rootOffset,
                fixedVelocity = float3.zero
            };
            constraints[1] = new Constraint()
            {
                pointIndex    = -1,
                fixedPosition = rootOffset,
                fixedVelocity = float3.zero
            };
            vectorData = new NativeArray <float3>(3, Allocator.Persistent);
            gravity    = new float3(0.0f, -9.8f, 0.0f);
#if false
            stiffness = 500.0f; //
                                //            restLength = 1.0f;
            dampingCoefficient = 1.0f;
            dragCoefficient    = 0.1f;

            restitutionCoefficient = 0.3f;
#else
            stiffness = 1300.0f; //
                                 //            restLength = 1.0f;
            dampingCoefficient = 7.0f;
            dragCoefficient    = 2.1f;

            restitutionCoefficient = 0.3f;
#endif
            UnitVector =
                new float3(baseAxis == BaseAxis.X ? 1.0f : 0.0f,
                           baseAxis == BaseAxis.Y ? 1.0f : 0.0f,
                           baseAxis == BaseAxis.Z ? 1.0f : 0.0f);

            MakeChain(length);
            baseAxis = AnimationJob.BaseAxis.Y;
            timeIntervalInSeconds  = 1 / 30.0f; // Time.fixedDeltaTime;
            resolution             = 0.5f;
            timeIntervalInSeconds *= resolution;
            elapsed = 0.0f;
        }
예제 #6
0
        protected virtual void GUICoreDisplay(ref CharacterBase cc)
        {
            // name of the character
            GUILayout.BeginHorizontal();
            GUILayout.Label("Name", GUILayout.Width(75));
            cc.Name = GUILayout.TextField(cc.Name, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();

            // axis
            GUILayout.BeginHorizontal();
            GUILayout.Label("Axis", GUILayout.Width(75));
            BaseAxis NewAxis = (BaseAxis)EditorGUILayout.EnumPopup(cc.CurrentAxis, GUILayout.ExpandWidth(true));

            if (cc.CurrentAxis != NewAxis)
            {
                cc.CurrentAxis = NewAxis;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // alignment
            if (cc.CurrentAxis != BaseAxis.Neutral)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Alignment", GUILayout.Width(75));
                BaseAlignment NewAlignment = (BaseAlignment)EditorGUILayout.EnumPopup(cc.CurrentAlignment, GUILayout.ExpandWidth(true));
                if (cc.CurrentAlignment != NewAlignment)
                {
                    cc.CurrentAlignment = NewAlignment;
                    cc.RebuildModifiers();
                }
                GUILayout.EndHorizontal();
            }

            // race
            GUILayout.BeginHorizontal();
            GUILayout.Label("Race", GUILayout.Width(75));
            BaseRace NewRace = (BaseRace)EditorGUILayout.EnumPopup(cc.CurrentRace, GUILayout.ExpandWidth(true));

            if (cc.CurrentRace != NewRace)
            {
                cc.CurrentRace = NewRace;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // class
            GUILayout.BeginHorizontal();
            GUILayout.Label("Class", GUILayout.Width(75));
            BaseClass NewClass = (BaseClass)EditorGUILayout.EnumPopup(cc.CurrentClass, GUILayout.ExpandWidth(true));

            if (cc.CurrentClass != NewClass)
            {
                cc.CurrentClass = NewClass;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // rank
            GUILayout.BeginHorizontal();
            GUILayout.Label("Rank", GUILayout.Width(75));
            BaseRank NewRank = (BaseRank)EditorGUILayout.EnumPopup(cc.CurrentRank, GUILayout.ExpandWidth(true));

            if (cc.CurrentRank != NewRank)
            {
                cc.CurrentRank = NewRank;
                cc.RebuildModifiers();
            }
            GUILayout.EndHorizontal();

            // life
            GUILayout.BeginHorizontal();
            GUILayout.Label("Life", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentLife.ToString("#,##0") + "/" + (cc.MAXLife + cc.BonusMAXLife).ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // life regen
            GUILayout.BeginHorizontal();
            GUILayout.Label("Life Regen", GUILayout.Width(75));
            GUIGenericValueDisplay(ref cc, ref cc.RegenLife, 0, 999);
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label((cc.RegenLife + cc.BonusRegenLife).ToString() + " per sec", GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // mana
            GUILayout.BeginHorizontal();
            GUILayout.Label("Mana", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentMana.ToString("#,##0") + "/" + (cc.MAXMana + cc.BonusMAXMana).ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // mana regen
            GUILayout.BeginHorizontal();
            GUILayout.Label("Mana Regen", GUILayout.Width(75));
            GUIGenericValueDisplay(ref cc, ref cc.RegenMana, 0, 999);
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label((cc.RegenMana + cc.BonusRegenMana).ToString() + " per sec", GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();


            // stamina
            GUILayout.BeginHorizontal();
            GUILayout.Label("Stamina", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label((cc.MAXStamina + cc.BonusMAXStamina).ToString("#,##0"), GUILayout.ExpandWidth(true));  //cc.CurrentStamina.ToString("#,##0") + "/" +
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // armour
            GUILayout.BeginHorizontal();
            GUILayout.Label("Armour", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label("Base " + cc.CurrentArmour.ToString("#,##0") + " Equipped " + cc.BonusArmour.ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // weight
            GUILayout.BeginHorizontal();
            GUILayout.Label("EquipLoad", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentEquipLoad.ToString("#,##0") + "/" + cc.MAXEquipLoad.ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();


            // XP & next level
            GUILayout.BeginHorizontal();
            GUILayout.Label("XP", GUILayout.Width(75));
            GUI.skin.label.alignment = TextAnchor.UpperRight;
            GUILayout.Label(cc.CurrentXP.ToString("#,##0") + "/" + cc.XPToNextLevel.ToString("#,##0"), GUILayout.ExpandWidth(true));
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            GUILayout.EndHorizontal();

            // current level
            GUILayout.BeginHorizontal();
            GUILevelDisplay(ref cc);
            GUILayout.EndHorizontal();
        }