How i’m make text in view and assotiate with point in my 3d model?
Text in view? Need exampleSoftware: Away3D 4.x |
||
|
||
Mr Margaret Scratcher, Sr. Member
Posted: 15 July 2014 04:38 PM Total Posts: 344 [ # 1 ] Well, you can either get the screen coordinates of an object, and move a movieclip to that position on every frame, or you could use the bitmap of the movieclip as a material for a plane, and put that plane in the positon of the object making it face the camera. I previously used a handy piece of code which scales an object up or down, to give it a constant size no matter how far away it is from the camera. I’m away from my work PC right now, so remind me to share it with you… |
||
|
||
ibsenleo, Newbie
Posted: 16 October 2014 10:55 PM Total Posts: 8 [ # 3 ] I’m new on this, but i think the easier way to do this is with the Sprite3D class (or at least i solved in this way). This class draws a plane that is always facing to the camera, so is interesting to get this effect work. I wrote a little function for show plain text in away3D 4 and with a little tweak you can get the same feel like that example. The next function only uses a flash TextField for render the text. After i get this text into a bitmapData and with this, i make a texture that i apply to my sprite. The text showed has no background, if you want a background you should use a flash Sprite behind the TextField or something similar. i left the code here: hope to be useful
private function createSpriteText(text:String,color:int = 0xffffff, size:int = 30, font:String = "Arial", bold:Boolean=false, bgVisible:Boolean = false, bgColor:int=0x000000):Sprite3D |
||
|
||
ibsenleo, Newbie
Posted: 16 November 2014 04:46 PM Total Posts: 8 [ # 5 ] I had to deal with some similar problem, and i found some solution (like the example you post does). The best choice is to create the text in the DisplayList of flash (not Away3d but flash 2D) and update the text coordinates with the projection of the 3D coordinates of your mesh. I solved like this:
private function getCoordinates2D(obj:ObjectContainer3D):Vector3D This returns a Vector 3D where x,y values (z value is useless) are the equivalent 2D in DisplayList of your 3D position viewed from the camera. Hope it helps! |