public void Initiate(BehaviourBase behaviour, SubBehaviourCOM centerOfMass)
        {
            this.behaviour    = behaviour;
            this.centerOfMass = centerOfMass;

            behaviour.OnPostRead += OnPostRead;
        }
        public void Initiate(BehaviourBase behaviour, SubBehaviourCOM centerOfMass, IKSolverFullBodyBiped solver)
        {
            this.behaviour    = behaviour;
            this.centerOfMass = centerOfMass;
            this.solver       = solver;

            behaviour.OnPostRead += OnPostRead;
        }
示例#3
0
        private void ActivateBehaviour(BehaviourBase behaviour)
        {
            foreach (BehaviourBase b in behaviours)
            {
                b.enabled = b == behaviour;

                // Call activate manually (also called in behaviour.OnEnable) because behaviour.OnEnable has been called already by Unity with the beahviour uninitiated.
                if (b.enabled)
                {
                    b.Activate();
                }
            }
        }
示例#4
0
        public void Initiate(BehaviourBase behaviour, Settings settings, Rigidbody Ibody, Rigidbody[] rigidbodies, ConfigurableJoint joint, Transform[] copPoints, PressureSensor pressureSensor)
        {
            this.behaviour      = behaviour;
            this.settings       = settings;
            this.Ibody          = Ibody;
            this.rigidbodies    = rigidbodies;
            this.joint          = joint;
            this.copPoints      = copPoints;
            this.pressureSensor = pressureSensor;

            toJointSpace = PhysXTools.ToJointSpace(joint);

            behaviour.OnPreFixedUpdate += Solve;
        }
示例#5
0
        public void Initiate(BehaviourBase behaviour, LayerMask groundLayers)
        {
            this.behaviour    = behaviour;
            this.groundLayers = groundLayers;

            rotation            = Quaternion.identity;
            groundContacts      = new bool[behaviour.puppetMaster.muscles.Length];
            groundContactPoints = new Vector3[groundContacts.Length];

            behaviour.OnPreActivate            += OnPreActivate;
            behaviour.OnPreLateUpdate          += OnPreLateUpdate;
            behaviour.OnPreDisable             += OnPreDisable;
            behaviour.OnPreMuscleCollision     += OnPreMuscleCollision;
            behaviour.OnPreMuscleCollisionExit += OnPreMuscleCollisionExit;
        }
示例#6
0
        public void Initiate(BehaviourBase behaviour, SubBehaviourCOM centerOfMass, LayerMask groundLayers, IKSolverFullBodyBiped solver)
        {
            this.behaviour    = behaviour;
            this.centerOfMass = centerOfMass;
            this.groundLayers = groundLayers;
            this.solver       = solver;

            behaviour.OnPreActivate    += OnPreActivate;
            behaviour.OnPostRead       += OnPostRead;
            behaviour.OnPreDisable     += OnPreDisable;
            behaviour.OnPostDrawGizmos += OnPostDrawGizmos;

            legs = new Leg[2] {
                new Leg(solver, behaviour.puppetMaster, FullBodyBipedEffector.LeftFoot),
                new Leg(solver, behaviour.puppetMaster, FullBodyBipedEffector.RightFoot)
            };
        }
        public void Initiate(BehaviourBase behaviour, SubBehaviourCOM centerOfMass, IKSolverFullBodyBiped solver)
        {
            this.behaviour    = behaviour;
            this.centerOfMass = centerOfMass;
            this.solver       = solver;

            behaviour.OnPreActivate += OnPreActivate;
            behaviour.OnPostRead    += OnPostRead;
            behaviour.OnPreDisable  += OnPreDisable;

            leftFootRigidbody  = behaviour.puppetMaster.GetMuscle(solver.leftFootEffector.bone).rigidbody;
            rightFootRigidbody = behaviour.puppetMaster.GetMuscle(solver.rightFootEffector.bone).rigidbody;

            leftFootMass  = leftFootRigidbody.mass;
            rightFootMass = rightFootRigidbody.mass;

            leftFootInertiaTensor  = leftFootRigidbody.inertiaTensor;
            rightFootInertiaTensor = rightFootRigidbody.inertiaTensor;
        }
        public void Initiate(BehaviourBase behaviour, LayerMask groundLayers)
        {
            this.behaviour = behaviour;
            this.groundLayers = groundLayers;

            rotation = Quaternion.identity;
            groundContacts = new bool[behaviour.puppetMaster.muscles.Length];
            groundContactPoints = new Vector3[groundContacts.Length];

            behaviour.OnPreActivate += OnPreActivate;
            behaviour.OnPreLateUpdate += OnPreLateUpdate;
            behaviour.OnPreDisable += OnPreDisable;
            behaviour.OnPreMuscleCollision += OnPreMuscleCollision;
            behaviour.OnPreMuscleCollisionExit += OnPreMuscleCollisionExit;
        }