How can i attach textfield to Plane3D?

Software: Away3D 3.x

jasonMiller, Newbie
Posted: 05 August 2012 03:54 AM   Total Posts: 4

I wanna make some object3D(plane) carrying textfield.
The plane must have textfield that could interact with mouse like rotate, magnify and move.
is it possible?
any ideas? If you know the solution, please let me know~!^^

   

Richard Olsson, Administrator
Posted: 05 August 2012 08:18 AM   Total Posts: 1192   [ # 1 ]

The only reasonable way to achieve this on the GPU (unless you want to write a text engine that lays out text built from glyphs as meshes) is to draw your TextField to a BitmapData and use it as a texture.

What kind of interaction do you want? Do you want to be able to interact with the text in the text field (edit it directly, select it et c) or do you just want to be able to rotate/move the entire plane?

   

jasonMiller, Newbie
Posted: 05 August 2012 10:43 AM   Total Posts: 4   [ # 2 ]

I wanna be able to edit and select it directly.
If i have to write a text engine, can I have a sample that could reference?
Totally I have a no idea…

   

Richard Olsson, Administrator
Posted: 05 August 2012 12:07 PM   Total Posts: 1192   [ # 3 ]

I’m afraid that what you’re trying to achieve is going to be quite complicated. There are basically three ways of doing it, and they may or may not work in your scenario.

- Implement your own MovieMaterial (or MovieTexture) with mouse interactivity. This will require updating the texture every frame, which is usually not something you want to do for performance reasons. If you want to go with this approach anyway, have a look at the Away3D 3.6 MovieMaterial (which has not been ported to Away3D 4.0) as well as the VideoTexture in Away3D 4.0 for how to update a texture every frame.

- Use regular text fields in the display list over the 3D scene when they need to be editable. Draw them to a bitmap when they don’t need to be editable. This, however, requires that your use case does not need the text fields to be transformed in 3D while they’re being interacted with.

- Implement your own text engine from scratch using 3D meshes, however this is going to be a lot of work. The idea here is to have a geometry for each glyph, and to lay them out using meshes, where you calculate the right position from the position and dimensions of the previous glyph, et c. If you have no idea how to move forward with this, it might prove be a little bit too big of an undertaking.

   

Avatar
Matse, Sr. Member
Posted: 05 August 2012 03:15 PM   Total Posts: 149   [ # 4 ]

Richard it looks like Jason is using Away 3.6 wink

Can’t comment as I never used anything but 4.x but your answers sound directed to 4.x , maybe that’s something doable more or less easily in 3.6 ?

   

Richard Olsson, Administrator
Posted: 05 August 2012 03:18 PM   Total Posts: 1192   [ # 5 ]

Ah good catch. My mistake!

In that case you can just use MovieMaterial, and set the “interactive” property to true.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X