Hi Greg, Sorry, Util3 is just a class I made for myself of handy utility functions. The degrees method just converts radians to degrees. You can replace that line with:
ang = (180/Math.PI)*(v2.getAngle(v1)); Because v1 and v2 are of type Number3D, you can take advantage of the numerous useful methods in the Number3D class, including getAngle(), which returns the angle in radians between two vectors that are characterized by two Number3D objects. camPos is the x,y,z position of the camera and is of type Number3D. In Away3D the Camera3D class has a property "position" which is of type Number3D. I believe the other Away3D cameras inherit from Camera3D so this property should be available for any camera. Ralph On Nov 10, 9:14 am, GBear <[email protected]> wrote: > Hey Ralph > > My AS3 knowledge is really lean, what's Util3 and how do I set/define > camPos please? > > I found the simple/best Text3D topic thanks, and I see you had same > issues as me trying to load font swf. I'm using CS4 and never got it > right from scratch, I just renamed the embedded example and worked > from there. > > I also spent half the weekend trying to publish and embed .obj without > luck, Flash seems to be way too tricky with this stuff. > > Thankfully Fabrice made Prefab and I managed to get the AS3 export > working, now we just need him to add text interface and we will be > Away :) > > Thanks in advance! > G > > On Nov 10, 4:23 pm, GBear <[email protected]> wrote: > > > Hi Ralph > > > Yip, it was unreliable, mixing front and back up completely. > > > Thanks a lot for this, I will give it a go and search through the old > > topics. > > > Cheers > > > Ralph B wrote: > > > I haven't re-checked this for CS4/FP10, but I understand from the > > > reasons that Li mentions below, bothsides=false is not always > > > reliable. If you want the text to be fully rendered when viewed from > > > the front and invisible when viewed from the rear, you can make both > > > sides visible, then hide the whole text object if it is facing away > > > from the camera with an algorithm like this: > > > > function hideReversedTextObject(obj, camPos){ > > > // Does a crude backface culling > > > var v1:Number3D = new Number3D(); > > > var v2:Number3D = new Number3D(); > > > var ang; > > > > v1 = obj.inverseSceneTransform.forward; // Vector facing away from > > > object > > > // Note: use inverseSceneTransform.forward (not > > > sceneTransform.forward) to get > > > // the vector that is normal to the plane of the object > > > (textfield). > > > > v2.sub( obj.scenePosition, camPos ); // vector to camera > > > > ang = Util3.degrees(v2.getAngle(v1)); // Angle between vector to > > > camera and vector facing away from the object. > > > obj.visible = (ang < 90); > > > } > > > > Also, if you look for topic "What is the latest/best/simplest 3d text > > > method to use?" in the groups I had posted a step-by-step technique > > > for using TextField3D in CS3, following Li's guidance. > > > > Ralph > > > > On Nov 8, 9:02 pm, GBear <[email protected]> wrote: > > > > Thanks Li, I'll give that a go and let you know how it comes out. > > > > > Cheers > > > > > Li wrote: > > > > > Hey GBear, > > > > > > Textfield3D has bothsides = true by default, that is, backface > > > > > culling is > > > > > disabled for text. You can enable it however by setting it to false. > > > > > This > > > > > might cause some problems because of the way vector fonts are > > > > > arbitrarily > > > > > designed; some glyphs are designed clockwise while others are > > > > > designed anti > > > > > clockwise. This orientation in the definition is crucial for back face > > > > > culling to be implemented properly. There is no convention in font > > > > > design > > > > > and I haven't yet produced a solution to counter this. > > > > > > The back property is not applicable for textfield3d. > > > > > > I would try using TextField3D with the font you have in mind and > > > > > bothsides = > > > > > false and see how many glyphs pop out. It depends on the font > > > > > really... If > > > > > you're not ok with that I would go for the Swf.as alternative. Break > > > > > some > > > > > text in the Flash IDE and import it in Away3D as a Sprite via Swf.as. > > > > > There > > > > > is a slight chance that by doing this (I still haven't tested it > > > > > enough) > > > > > Flash will resolve the arbitrary font definitions to its own terms > > > > > and hence > > > > > produce more coherent material for the engine. > > > > > > hth > > > > > Li > >
