playMaker

Author Topic: Info Plane to appear in front of camera  (Read 3533 times)

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Info Plane to appear in front of camera
« on: June 26, 2014, 09:52:12 AM »
Hi

having a really hard time with something that should be simple.  I have a camera at 0,0,0 with free look.  At some point I want a hidden plane to move towards the camera, directly in front of it and display some info.

This must happen no matter what Y direction the camera is facing.  The plane will be at a set height from the ground.

I am strugggling to get the plane to do this I have tried Lookto, itween, Rotate to and none seem to work as I thought they might.

Can someone help me please as I have spend a couple of days on this with no real outcome.

Obviously completely missing something fundemental.

Any pointers would be a great help.

Thank you

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Info Plane to appear in front of camera
« Reply #1 on: June 26, 2014, 10:18:54 AM »
Does this have to be in the 3D scene?  Why not just do it as a 2D GUI texture and attach it to the camera? (and show/hide it as needed)

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Info Plane to appear in front of camera
« Reply #2 on: June 26, 2014, 10:24:19 AM »
Thanks for replying Jess. 

That would be the normal way of doing this.

The plane displaying the info interms of a texture is part of the games "fabric" so I can't do the GUI thing.  Thats why it is driving me mad as it should be the opposite of a over the shoulder camera.... :)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Info Plane to appear in front of camera
« Reply #3 on: June 26, 2014, 10:47:53 AM »
Why not use a second camera that doesn't move to display the info and just change its render depth to last so it always appears on top of everything else.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Info Plane to appear in front of camera
« Reply #4 on: June 26, 2014, 11:06:54 AM »
Thanks Lane. 

I am constricted and can only use one camera.

This is an experiemental Oculus Rift freebie and Unity does not like two Rift cameras.

I really want to associate the current position with the information on the plane so jumping to another point breaks that connection.

So that is not an option either.

Thank you for your suggestion though.

Cheers

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Info Plane to appear in front of camera
« Reply #5 on: June 26, 2014, 11:29:27 AM »
Ah for the Rift, of course you can't use more cameras then =)

It's not as easy as you might think. If you're code savvy then search VRGUI on the OVR forums. There is also an example of 3d gui that OVR provides in the Unity SDK, it's how they did the stats popup stuff when you press spacebar in their demo's. I haven't looked much into either of those solutions though.

I'm working this now as well and I'm narrowing down how it actually should work as I go along. I don't use any native GUI. At this point I raycast from screen to world space on to a GUI layer that my 3d buttons are on. Mouse down sends events to the buttons. The buttons are in a wrapper and set as a child of the controller, or one of the cameras. The mouse is just an object placed at the raycast's hitpoint of the gui layer.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Info Plane to appear in front of camera
« Reply #6 on: June 26, 2014, 11:37:54 AM »
Sounds spot on mate.

This is not about control, simply information that needs to be presented at that point.

I can see you have had the same stumbling blocks... lol

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Info Plane to appear in front of camera
« Reply #7 on: June 26, 2014, 11:48:35 AM »
Hah, yeah the Rift throws a lot of curveballs at a design for sure. Hopefully we'll see more standardized solutions as it grows in popularity but a lot of the problems haven't even been found yet, much less the solutions to them so we're kind of just experimenting with trial and error stuff.

If its just data display then I would keep it simple, just parent it to the controller (not the rift cameras, things stuck to your face are really annoying), make sure its far enough away from the face and turn it on/off when you want. Thats the best way I've found to handle it so far.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Info Plane to appear in front of camera
« Reply #8 on: June 26, 2014, 12:12:31 PM »
Hang on it can't be that simple... face plant.

OVR parent, playmaker toggles on or off as necessary?

 ::)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Info Plane to appear in front of camera
« Reply #9 on: June 26, 2014, 07:41:51 PM »
Sure, why not?

The question you should be asking is why it wouldn't work. ;)
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Info Plane to appear in front of camera
« Reply #10 on: June 27, 2014, 05:01:58 AM »
And face plant it isn't.   ???

The plane appears but at a 90 degree offset by 2 units to the right.

Spot on if directly in front.... but alas.  So I guess the question now is how to activate a plane directly in front of the camera offset by 2 to 3 units...

Help this is driving me crazy.  :o

You are right why isn't it easy?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Info Plane to appear in front of camera
« Reply #11 on: June 27, 2014, 11:05:39 AM »
Are you putting it in there in the editor and just toggling it on/off at runtime or are you creating the object at runtime and defining a spawn point?

If you're doing it in the editor then it should be simple to change the rotation, if you're making it at runtime then I would just make an empty game object where I want it to spawn as a child object and choose that as the spawn point. The rotation would just be trail and error if it wasn't appearing correctly.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

unclebob

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Info Plane to appear in front of camera
« Reply #12 on: June 30, 2014, 06:06:32 AM »
Hey Lane

Really appreciate you taking an interest.

At the moment I have the plane already created but inactive and on a raycast becomes active and visible.

However, the camera is not necessarily pointing to the plane when activated. 

So when it is parented to the camera controller is appears on an offset but at 90 degrees to direction the camera is facing not directly in front.

When not parented it appears at a defined vector but the camera will not rotate to view.

Cheers

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Info Plane to appear in front of camera
« Reply #13 on: June 30, 2014, 07:19:07 AM »
Sounds like you're parenting it at runtime, you could set the rotation after parenting it in self space, that would be consistent.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D