// ============================================= // #endregion // Start is called before the first frame update void Start() { // Extract terrain information if (!terrain) { //terrain = Terrain.activeTerrain; terrain = myBipedalCharacter.GetComponent <RigidBodyControllerSimpleAnimator>().currentTerrain; Debug.Log("[INFO] Main terrain: " + terrain.name); } terrain_collider = terrain.GetComponent <Collider>(); terrain_data = terrain.terrainData; terrain_size = terrain_data.size; heightmap_width = terrain_data.heightmapResolution; heightmap_height = terrain_data.heightmapResolution; heightmap_data = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); heightmap_data_constant = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); heightmap_data_filtered = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); brushPhysicalFootprint = null; // Get classes _feetPlacement = FindObjectOfType <IKFeetPlacement>(); // Retrieve components and attributes from character mass = myBipedalCharacter.GetComponent <Rigidbody>().mass; _anim = myBipedalCharacter.GetComponent <Animator>(); // Time elapsed -> TODO: Smoothing //elapsed = 0f; // Old Feet Y-component position oldIKLeftPosition = _anim.GetBoneTransform(HumanBodyBones.LeftFoot).position; oldIKRightPosition = _anim.GetBoneTransform(HumanBodyBones.RightFoot).position; oldIsMoving = _anim.GetBool("isWalking"); }
// Start is called before the first frame update void Start() { // Extract terrain information if (!terrain) { terrain = Terrain.activeTerrain; } terrain_collider = terrain.GetComponent <Collider>(); terrain_data = terrain.terrainData; terrain_size = terrain_data.size; heightmap_width = terrain_data.heightmapResolution; heightmap_height = terrain_data.heightmapResolution; heightmap_data = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); heightmap_data_constant = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); heightmap_data_filtered = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); brushPhysicalFootprint = null; // Get classes _feetPlacement = FindObjectOfType <IKFeetPlacement>(); _ragdoll = FindObjectOfType <Ragdoll>(); // Retrieve mass from Ragdoll mass = _ragdoll.CalculateMass(); // Time elapsed elapsed = 0f; // Old Feet Y Position oldIKLeftPosition = _anim.GetBoneTransform(HumanBodyBones.LeftFoot).position; oldIKRightPosition = _anim.GetBoneTransform(HumanBodyBones.RightFoot).position; oldIsMoving = _anim.GetBool("isWalking"); }
// Initialization void Start() { // Extract terrain information if (!terrain) { terrain = Terrain.activeTerrain; } terrain_collider = terrain.GetComponent <Collider>(); terrain_data = terrain.terrainData; terrain_size = terrain_data.size; heightmap_width = terrain_data.heightmapResolution; heightmap_height = terrain_data.heightmapResolution; heightmap_data = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); heightmap_data_constant = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); heightmap_data_filtered = terrain_data.GetHeights(0, 0, heightmap_width, heightmap_height); current_brush = null; // Get classes _feetPlacement = FindObjectOfType <IKFeetPlacement>(); _ragdoll = FindObjectOfType <Ragdoll>(); // Retrieve mass from Ragdoll mass = _ragdoll.CalculateMass(); // Time elapsed elapsed = 0f; }
// Start is called before the first frame update void Start() { // From same GameObject _rb = GetComponent <Rigidbody>(); // From other GameObject _feetPlacement = FindObjectOfType <IKFeetPlacement>(); }
// Start is called before the first frame update void Start() { // Create instance for the PID (not attached to GameObject) _pidController = new PIDController(); // From same GameObject _anim = GetComponent <Animator>(); _rb = GetComponent <Rigidbody>(); _feetIK = GetComponent <IKFeetPlacement>(); _projectedCOMs = GetComponent <ProjectCOM>(); _terrain = GetComponent <TerrainMaster>(); // Get object to be balance (connected to joint) and change CoM if necessary _rbObjectConnected = hipsConnector.GetComponent <Rigidbody>(); _rbObjectConnected.centerOfMass = _rbObjectConnected.centerOfMass + centerOfMassChangeUp * transform.up; }