// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- // MonoBehaviourのメソッド void Start() { app = new FWHapticApp(); app.CreateSdk(); app.GetSdk().CreateScene(); app.SetPHScene(phSceneBehaviour.phScene); app.CreateTimers(); // phSceneBehaviour.enableStep = false; // phSceneBehaviour.phScene.GetHapticEngine().Enable(true); phSceneBehaviour.phScene.GetHapticEngine().SetHapticStepMode(PHHapticEngineDesc.HapticStepMode.LOCAL_DYNAMICS); // pointer = phSceneBehaviour.phScene.CreateHapticPointer(); var shapeDesc = new CDSphereDesc(); shapeDesc.radius = 0.1f; var shape = phSceneBehaviour.phScene.GetSdk().CreateShape(CDSphereIf.GetIfInfoStatic(), shapeDesc); pointer.AddShape(shape); pointer.SetHapticRenderMode(PHHapticPointerDesc.HapticRenderMode.CONSTRAINT); pointer.SetLocalRange(20.0f); pointer.SetPosScale(100); pointer.EnableForce(true); var fwPointer = app.GetSdk().GetScene(0).CreateHapticPointer(); fwPointer.SetHumanInterface(hiSpidarGBehaviour.hiSpidar); fwPointer.SetPHHapticPointer(pointer); // pointerObj = GameObject.CreatePrimitive(PrimitiveType.Sphere); // pointerObj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); // app.GetTimer(0).SetInterval(10); app.GetTimer(1).SetResolution(1); app.GetTimer(1).SetInterval(1); app.StartTimers(); }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- // CDShapeBehaviourの派生クラスで実装するメソッド // -- SpringheadのShapeオブジェクトを構築する public override CDShapeIf CreateShape(GameObject shapeObject) { SphereCollider sc = shapeObject.GetComponent <SphereCollider>(); if (sc == null) { throw new ObjectNotFoundException("CDSphereBehaviour requires SphereCollider", shapeObject); } Vector3 scale = shapeObject.transform.lossyScale; desc.radius = sc.radius * (Mathf.Max(Mathf.Max(scale.x, scale.y), scale.z)); return(phSdk.CreateShape(CDSphereIf.GetIfInfoStatic(), (CDSphereDesc)desc)); }