Coordinate conversion

14 views
Skip to first unread message

David Baird

unread,
Apr 3, 2012, 1:24:43 PM4/3/12
to sce...@googlegroups.com
I am a newbie to scene graphs. I think I need a couple functions that do world-to-local and local-to-world coordinate transformations (by applying or reversing all the intermediate transformations). At any moment in time, I may need to read the state (translation, rotation, scale) of an object, convert it to world coordinates, do some manipulations, then modify the state (after converting back to object coordinates).

As a test, I have copied the basic picking example (http://scenejs.org/dist/v2.0.0/extr/examples/basic-picking/index.html) and added an extra translation node around the red ball. So, if I could find a way to apply all nested translations, scaling, etc. and then project that result into canvas X/Y (like there is a line shooting perpendicular to the canvas through the object), and then be able to essentially grab that line and move it around, that is what I am trying to do.

I see that I can bind to the "rendered" event, and then get some nice information (getCameraMatrix(), getViewMatrix(), getCanvasPos(), ...),

http://scenejs.wikispaces.com/SceneJS.withNode+-+bind (I know, this is for an older API)

I think this might be what I need, except that I wonder if there is any other way to get this besides binding the "rendered" event? Any help (even a hint or suggestion) would be greatly appreciated!

Sincerely,
David

Reply all
Reply to author
Forward
0 new messages