playMaker

Author Topic: Prefab Look At  (Read 1213 times)

grimmy

  • Junior Playmaker
  • **
  • Posts: 67
    • View Profile
Prefab Look At
« on: February 14, 2014, 09:05:55 AM »
I have a prefab tree sprite which I always want to look at the main camera. The problem is that I can't assign my prefab 'Target Object' an object within the scene (ie the main camera). I can only choose from prefabs.

How do I make a my tree prefab always face the camera so I don't have to assign the target object again to every instance each time I place a new tree?

phannDOTde

  • Full Member
  • ***
  • Posts: 238
    • View Profile
    • Peter Hann .de
Re: Prefab Look At
« Reply #1 on: February 14, 2014, 11:18:47 AM »
Use get current cam or get main cam (not sure how its called) in the inti of the tree script - put the cam in a local game object variable - use that variable as look at goal.

Or put the Cam (or what ever Object) in a Global Variable and use that instead in your prefab as look at target

cheers
peter