void handleMocap(Google.Protobuf.VRCom.MocapSubject msg) { // the data coming in from the websocket is OpenGL convention, X Right, Y UP, Z Backward // Unity is the same but with Z pointing forward. So we are mirroring about the XY plane. newpos.Set(msg.Pos.X / 1000, msg.Pos.Y / 1000, -msg.Pos.Z / 1000); newrot.Set(msg.Rot.X, msg.Rot.Y, -msg.Rot.Z, -msg.Rot.W); }
void handleWiiMocap(Google.Protobuf.VRCom.MocapSubject wii) { wandpos.Set(wii.Pos.X / 1000, wii.Pos.Y / 1000, -wii.Pos.Z / 1000); wandrot.Set(wii.Rot.X, wii.Rot.Y, -wii.Rot.Z, -wii.Rot.W); transform.localPosition = wandpos; transform.localRotation = wandrot; wordpos = transform.position + transform.forward * .30f; }
void handleMocap(Google.Protobuf.VRCom.MocapSubject head) { //Debug.Log ("mocap data"); // the data coming in is OpenGL convention, X Right, Y UP, Z Backward // Unity is the same but with Z pointing forward. havemocap = true; // position is in mm for Vicon. In Unity we usually model with metres. newpos.Set(head.Pos.X / 1000, head.Pos.Y / 1000, -head.Pos.Z / 1000); newrot.Set(head.Rot.X, head.Rot.Y, -head.Rot.Z, -head.Rot.W); }