playMaker

Author Topic: [Solved] Text on a cylinder that always faces moving camera  (Read 2700 times)

Kfinn

  • Playmaker Newbie
  • *
  • Posts: 8
[Solved] Text on a cylinder that always faces moving camera
« on: September 25, 2014, 12:22:50 PM »
Hi all. I have a cylinder game object on which I'd like to have some simple text (the number '1', for example).  I've created a cool text object via Textmesh Pro so that's not an issue.  In my setup, the camera can move around this cylinder in all three dimensions and is controlled by the user's finger (iOS).  I'd like the text object to always face the camera but be confined to the surface of the cylinder in a sensible way (i.e. not upside down or sideways, just oriented vertically and parallel to the cylinder surface). 

Hopefully that makes sense.  The Look At function (target = Main Camera) kind of does what I need but the text doesn't 'stick' to the cylinder like I require.  Any thoughts on a PlayMaker action that meets this need?

Thx!!
« Last Edit: September 26, 2014, 11:15:34 AM by Kfinn »

Kfinn

  • Playmaker Newbie
  • *
  • Posts: 8
Re: [Solved] Text on a cylinder that always faces moving camera
« Reply #1 on: September 26, 2014, 11:19:30 AM »
Solved this.  If anybody runs into the same issue, here's the solution:

-Make your text object
-Put it inside an empty game object (GO)
-Place the position of the new GO at the center of the cylinder
-Place the text game object at the surface of the cylinder
-Get your camera rotation (every frame) as VectorXYZ
-Use Set Rotation and apply (in my case), the Y value to the GO every frame
-Use 'Self' space (my ultimate issue...)

HTHs somebody  :)

app_advisory

  • Junior Playmaker
  • **
  • Posts: 80
    • App Advisory
Re: [Solved] Text on a cylinder that always faces moving camera
« Reply #2 on: October 13, 2014, 11:00:05 AM »
Hi,

You can simply get the rotation of the main camera and set the rotation of your textMesh every frame, that's it ;)