Hello Guest

Author Topic: Set Sprite Normals up?  (Read 4453 times)

brownboot

  • Newbie
  • *
  • Posts: 2
    • View Profile
Set Sprite Normals up?
« on: June 13, 2014, 01:55:46 pm »
I have tk2dSprites in my 3d environment that I am billboarding.  I need to set their normals to Vector3.up (they pop back and forth a lot as the camera rotates around and I'd rather it approximate ambient lighting; ghetto example: http://tinyurl.com/oojpphc).  I have a script that works for a MeshFilter but from the documentation I couldn't figure out how to do the same thing targeting the tk2dSprite component and need some pointers... thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Set Sprite Normals up?
« Reply #1 on: June 13, 2014, 11:25:31 pm »
You'll need to modify the code.
tk2dBaseSprite.SetPositions sets up the vertex positions and normals. You can hardcode whatever you like there.

Alternatively... you could simply override the shader and hard code it in there.

brownboot

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Set Sprite Normals up?
« Reply #2 on: June 21, 2014, 02:35:17 pm »
Thanks for the pointers! Got me where I needed to be:



For newbie-posterity this is what I added at line 423 of the BaseSprite code: normals = Vector3.up ;