public void load_character(CharacterLoader aLoader) { NGM.mManager.mBackgroundManager.load_character(aLoader); FlatBodyObject flatbody = new FlatBodyObject(aLoader, -1); flatbody.set_target_pose(NGM.CurrentPose, true); flatbody.HardPosition = new Vector3(10, 0, 0); flatbody.update(0); flatbody.set_layer(1 << 1); flatbody.PrimaryGameObject.name = "SIMIANBODY"; //needed to make debugviewerthing work var cam = mManager.gameObject.AddComponent <Camera>(); cam.transform.position = mManager.mCameraManager.MainBodyCamera.transform.position; cam.transform.rotation = mManager.mCameraManager.MainBodyCamera.transform.rotation; cam.fieldOfView = mManager.mCameraManager.MainBodyCamera.fieldOfView; cam.orthographic = mManager.mCameraManager.MainBodyCamera.orthographic; cam.orthographicSize = mManager.mCameraManager.MainBodyCamera.orthographicSize; Debug.Log(mManager.mCameraManager.MainBodyCamera.orthographicSize); cam.depth = 9999999; cam.clearFlags = CameraClearFlags.Depth; cam.cullingMask = 0; mSimian = new FarseerSimian(); mSimian.initialize(mManager.gameObject); mSimian.setup_with_body(flatbody); //this is stupid mSimian.add_environment(GameObject.FindObjectsOfType(typeof(Transform)).Where(e => e.name.StartsWith("FS_")).Select(e => ((Transform)e).gameObject)); }
public void set_pose(Pose aPose) { if (mBody != null) { mBody.set_target_pose(aPose); } }
public void set_target_pose(Pose aPose, bool hard = false) { mFlat.set_target_pose(aPose, hard); //hack because the hard parameter above does not seem to work... if (hard) { for (int i = 0; i < 100; i++) { mFlat.update_parameters(100); } } //hack hack if (((ManagerManager.Manager.mRecordMode) && mMode == 1)) { for (int i = 0; i < 100; i++) { mFlat.update_parameters(100); } mFlat.HardColor = new Color32(255, 255, 255, 255); mFlat.SoftInterpolation = 1; mFlat.set(); } }
public ChoiceObjectPair(Texture2D aLeftTex, CharacterTextureBehaviour aChar, Pose aPose, int aDepth) { mSquare = new FlatElementImage(aLeftTex, aDepth); //NOTE these assets were removed since this class is no longer being used. //mDifficultyStars = new DifficultyObject(ManagerManager.Manager.mNewRef.uiPerfectStar, aDepth); //mDifficultyBalls = new DifficultyObject(ManagerManager.Manager.mNewRef.uiPerfectStar, aDepth); mElements.Add(new FlatElementMultiBase.ElementOffset(mSquare, new Vector3(mSide, 0, 0))); mElements.Add(new FlatElementMultiBase.ElementOffset(mDifficultyStars, new Vector3(-mSide, mRightBot, 0))); mElements.Add(new FlatElementMultiBase.ElementOffset(mDifficultyBalls, new Vector3(-mSide, mRightBot, 0))); mMeter = new MeterImageObject(aLeftTex, null, MeterImageObject.FillStyle.DU, aDepth + 1); mMeter.Percentage = 0.0f; mBody = new FlatBodyObject(aChar, aDepth + 2); mBody.set_target_pose(aPose); mElements.Add(new FlatElementMultiBase.ElementOffset(mMeter, new Vector3(mSide, 0, 0))); mElements.Add(new FlatElementMultiBase.ElementOffset(mBody, new Vector3(mSide + 24, -7, 0))); PrimaryGameObject = create_primary_from_elements(); }
public void update(ProjectionManager aManager) { //set desired position from projection manager foreach (KeyValuePair <ZgJointId, ProjectionManager.Stupid> e in aManager.mImportant) { if (mBodies.ContainsKey(e.Key)) { //ManagerManager.Manager.mDebugString = mBodies[ZgJointId.Waist].body.Rotation.ToString(); if (e.Key != ZgJointId.Waist) //pretty sure this is because waist is controlled by torso, i.e. the degree of freedom we give up to allow the body to move around freely { rotate_body_to(mBodies[e.Key].body, mBodies[ZgJointId.Waist].body.Rotation + (e.Value.smoothing.current - mBodies[e.Key].offset) * Mathf.PI / 180f); } } } //update the visual body to match the physics body mFlat.set_target_pose(physics_pose()); mFlat.SoftInterpolation = .5f; mFlat.SoftPosition = mBodies[ZgJointId.Torso].body.Position.toV3() / GameConstants.SCALE; //mFlat.HardPosition = mFlat.SoftPosition; mFlat.update(0); }