playMaker

Author Topic: Oculus + Playmaker + First Person + Head Joint[solved]  (Read 3728 times)

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
Oculus + Playmaker + First Person + Head Joint[solved]
« on: April 30, 2014, 05:45:22 AM »
Hi Guys,

getting frustrated with this one :/
I'm trying to move the head of my first person mesh with the Oculus. So if the Oculus turns left, the head of the character does. If the Oculus looks right, the head does also and so on.

Simple parenting the head joints under the cameras didn't solve the problem. This just results in odd head orientations.

What I also did:
creating a vector3 variable and a state with a "Get Rotation" action parameter on it. It stores the vector3 data from the Oculus (CameraRight). This vector3 Variable is now been used with the "Rotate" action with the Headjoint as the game Object.
If the game starts the head of the character permanetly rotates, it looks like some crazy headbanging or exorcist stuff :D. I guess this comes from the fact that the oculus permanently sends data to the rotate action even the oculus stands still.

this can't be so difficult, there are some videos on the net and lots of forum topics on developer.oculusvr.com witch suggestions for this set up. But the thing is nobody posts a tutorial or some deeper informations. Just some piece of Code which i don't understand (that's the reason i bought playmaker)

some examples what it should look like:

or this example:
(he also uses playmaker but i guess with self written code)

please help me. Each suggestions are welcome :)
« Last Edit: May 06, 2014, 07:39:43 AM by Blubbfischtier »

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Oculus Rift + Playmaker + First Person + Head Joint Orientation
« Reply #1 on: April 30, 2014, 06:42:46 AM »
ok, i found a solution, BUT without using playmaker. Just scripting…

accordingly to this post:
https://developer.oculusvr.com/forums/viewtopic.php?f=37&t=6452

my script now looks like this:
Code: [Select]
using UnityEngine;
using System.Collections;

public class HeadOrientation : MonoBehaviour {

//public head gameObject;
public Transform headBone = null;
public Transform cameraObject = null;
public Vector3 neckCorrectionEuler;


void LateUpdate()
{
headBone.rotation = cameraObject.rotation * Quaternion.Euler (neckCorrectionEuler);
}
}

Now the head of the character moves right depending on the Oculus movement.
I Guess this topic is solved for me now, but i would prefer a solution with playmaker. If someone finds a solution i would be very grateful.


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Oculus Rift + Playmaker + First Person + Head Joint Orientation
« Reply #2 on: April 30, 2014, 07:22:55 AM »
or this example:
(he also uses playmaker but i guess with self written code)

There's no self written code here =)

It's really not that complex, its a matter of hierarchy. Basically this is how it works...

  • The Rift should be parented to the character
  • For this case I created and empty game object directly in front of the Rift object called "Forward".
  • I use the Mecanim Animator Playmaker actions to define the "Forward" object as the look at target for the head.
  • Now put the Rift physically at the base of the neck joint and use the appropriate offset to move it up to eye level at runtime.

Voila. No scripts, basic hierarchy setup driven by correctly defined joints and offsets.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Oculus Rift + Playmaker + First Person + Head Joint Orientation
« Reply #3 on: May 05, 2014, 06:08:44 PM »
Thanks Lane for your response!

I Tried your solution but i don't get a movement out of my characterwhat i'm doing wrong? :(

1. The Rift should be parented to the character -> check
2. For this case I created and empty game object directly in front of the Rift object called "Forward". -> where to place? (I guess under the Right Camera, because the forward Object should follow the camera)
3. I use the Mecanim Animator Playmaker actions to define the "Forward" object as the look at target for the head. -> Action Window "Set Animator Look At", right?
4. Now put the Rift physically at the base of the neck joint and use the appropriate offset to move it up to eye level at runtime. -> check



(did you tried this solution yourself? and could you upload your test scene? … I don't get that :D



Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Oculus Rift + Playmaker + First Person + Head Joint Orientation
« Reply #4 on: May 05, 2014, 07:06:21 PM »
Do you have Unity Pro for the IK stuff?


Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Blubbfischtier

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Oculus Rift + Playmaker + First Person + Head Joint Orientation
« Reply #5 on: May 06, 2014, 07:38:39 AM »
Lane you're awesome!

Yes, i got the Oculus and the pro version from my high shool :)
Now, after watching your video, i recognize my mistake from yesterday. The player was no mecanim character. The animation type was not set to "Humanoid".

Thanks a lot for your effort and the video you did. You helped me a lot!
« Last Edit: May 12, 2014, 06:12:34 PM by Blubbfischtier »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Oculus + Playmaker + First Person + Head Joint[solved]
« Reply #6 on: May 06, 2014, 08:12:55 AM »
Great! I'm glad it helped, I had been wanting to make that one for a while now.

Remember with DK2 and the updated SDK they'll soon have the positional tracking, so you will probably need to adjust some things and take that into consideration.

Keep us posted with what you do on this, theres so much potential for cool stuff with the Rift =)
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D