playMaker

Author Topic: Need Some Oculus Rift Playmaker Help.  (Read 2406 times)

melfice787

  • Playmaker Newbie
  • *
  • Posts: 4
Need Some Oculus Rift Playmaker Help.
« on: February 21, 2015, 04:45:27 AM »
I have been hitting my head against a wall for a few days trying to figure out how to use Playmaker with the Rift. I have tried both the Raycast action in the OVR rig as well as just attaching a box collider to the OVR rig to trigger events.

I can do certain things like change color of certain objects off and on but once it gets more complex than that I hit the ceiling of my abilities with it. I am struggling to understand using playmaker with the Rift.

With either method, the Raycast action or attaching a stretched out box to the OVR camera can someone please explain the logic for me to for instance:

-When I look at an object it starts to rotate, when I look off it rotates back to its origin.

-When I look at an object, it plays an animation, then when I look off it rewinds that animation back to 0.

-When I look at an object, I can hit a key to envoke some sort of animation or movement etc.

If someone can show this noob how its done I will thank you for all eternity...

I think if I can understand those things I can move forward with prototyping my game. Other than the Raycasting I really love Playmaker, it has been helping me so much until I got into the VR stuff.

Thank you again!!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Need Some Oculus Rift Playmaker Help.
« Reply #1 on: February 21, 2015, 09:58:27 AM »
All the basic state management principles still apply, nothing is different in that department.

You would just use a raycast or spherecast from the ovr camera with a layer mask on the layer that your interactive objects are on. When it hits something, move to the next state where you directly rotate or send an event to rotate that object. When the Ray is hitting nothing or the hit object changes then you can stop rotating the object.

The mid point between the cameras is technically the best place to raycast from for look related stuff. Either eye alone will be slightly off.
« Last Edit: February 21, 2015, 10:00:29 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

melfice787

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Need Some Oculus Rift Playmaker Help.
« Reply #2 on: February 21, 2015, 02:48:07 PM »
Hey Lane,

First off thank you so much for answering my questions. I wrote them pretty late last night with only a few onces of brainpower I had left after staring at my laptop screen for several hours trying to get something to work.

I have noticed that you have answered most if not all the oculus questions on the forum so I want to thank you for that as well. Also, what I am currently trying to do is based on a lot of feedback you have given regarding the raycast stuff when I run searches in the forums looking for answers. I am still hitting a wall with this stuff, I just cant seem to grasp the concept of the raycasting in playmaker and I apologize for already bugging about it.

Here is what I have.
-GameObject with Raycast on it called "RaycastManagerCurved"
-Cube with FSM and layer called "RayHit"
-Animation named CubeRayRot

What I am trying to accomplish is:
-When I look at this cube it plays the animation "CubeRayRot"
-When I look off the cube it stops the animation and plays it in reverse to 0.

I have attached some images with what I have so far and it is more or less the setup I got after seeing your answer to the highlighted/unlighted question.

Again I hope I am not asking for too much and I really appreciate any help. I just cannot for the life of me understand the raycast stuff within playmaker.''

Thank you!


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Need Some Oculus Rift Playmaker Help.
« Reply #3 on: February 21, 2015, 03:45:40 PM »
You're close.

I would do it with only two states and on any interactive object add a generic FSM with a global event called "RayHit" or something.

The raycasting should be done from a manager, or something on the OVR system that makes sense, but it really doesn't matter. You need to define where the ray starts from and shoot forward in self space - which you have. You're good there.

Now when you hit something with the raycast you can store the hit object and transition to a second state. In the second state you need to use Send Event, target the Hit Object, and send the "RayHit" event and add another Raycast just like the original, but instead of transitioning on a hit, use a GameObject compare to see if the Hit Object is the same as the one from the first raycast, or if its null. This basically means it will continue raycasting in the second state until it hits something different, or nothing at all in which case it would return to the first state.

You also need to send a "RayNotHitting" event back to the Hit Object so that it knows when you arent looking at it anymore.

Now what you have with this situation is a generic raycaster sending "RayHit" to any object it hits, on a layer mask of course, and now you can go to that individual object and add the RayHit event and do anything you want to it. You could use a template to do a generic rotate for the owner when this happens, or make each one unique, whatever you want here now.

I hope this helps and is clear, I've been really sick lately and kind of in a mind fog so this might just confuse you more lol. In any case, thats essentially the way I handled it and if you setup the raycaster to deliver the events correctly then its basically fool-proof.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

melfice787

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Need Some Oculus Rift Playmaker Help.
« Reply #4 on: February 22, 2015, 02:13:10 AM »
Hello Lane,

Thank you for the info and response, I am sorry that you are not feeling well and I hope you get better soon.

I think I understand the logic of what your approach is and I think its brilliant. I think what you are saying is that you created a raycast template that talks to the global "RayHit" events on other objects and once the ray hits you continue to create states in the object rather than creating new FSMs on the manager each time.

I tried to set it up like you advised but I was definitely still a little confused. When I try to fire the ray on an object it freezes and I get a loop count exceeded maximum error.

I set my test up like this. I also attached images to show my steps I hope you don’t mind looking through it and pointing out where I need to fix things to make it work.

I have a RaycastManager in the OVR Camera Rig
Events
-HitInteractiveObject
-HitNothing

Variable
-HitObject(GameObject with CubeAnimation_2 as the Game Object

My object is a 3d cube called CubeAnimation_2
Global Event
-RayHit

Object Layer
-currentlyHit

I hope I was close to what you were describing, it feels like I am. Thank you again!

melfice787

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Need Some Oculus Rift Playmaker Help.
« Reply #5 on: February 23, 2015, 03:22:41 AM »
Hey again Lane,

So I went through and checked everything a bunch of times and found some things I needed to sort out so now I am getting the raycast to hit on the object correctly and transition to the second state, the only problem I still have is getting the raycast to flow back into the first state after I hit the object and move off of it.

I attached some pictures again to show my steps seems like everything is right? All the names are the same except I changed “HitNothing” to “RayNotHitting” because I was trying to follow your directions to a tee and it just helped me keep track of everything.

Thank you again!