Static component/object in front of camera
-
Hey everyone
I'm a Sketchup/Ruby newbie and I would really appreciate any help you could give me concerning the handling of dynamic components through Ruby codes. I was just wondering... Is it possible to create any object (rectangle, component, etc) and code it so that it always stays in front of the camera? I'm planning to create a toolbar in the scene itself. In order to make it look static, I'm searching for a way to glue it in space, wherever the user goes.
It is important that we use Ruby codes for this since this is part of a bigger project. Any help will be greatly appreciated.
Cheers
-
digged a bit.
i was thinking of the same: glueing a component to the camera (which is threated as a object inside sketchup, isn't it?) and use it as a custom navigation. e.g. creating a 3 by 3 grid as a dynamic component "scene selector". for giving easy-to-understand interactive presentation to viewers.
so i brought this old thread up again, someone has an idea?
-edit- maybe better move this thread to plugins-forum..
-
In fact you don't want to glue it in space at all!
You want to work out the camera changing data at every instant - its location [camera.eye], its .target, .up etc from these you can determine an ever changing point in 3D space that is say 1m in front of the eye towards the target [eye.vector_to(target)].
Your special component is also located at this point using an observer for it to check if the camera has changed and if so it transforms that component instance to be at that new point, and rotated on its Z axis so that its Y axis is equivalent to 'camera.up' and its Z axis is equivalent to target.vector_to(eye)... -
The obvious observer would be the ViewObserver, but it gets called so frequently that I'm wary of using it at all.
Here's a similar idea: http://forums.sketchucation.com/viewtopic.php?p=197195#p197195
-
Thanks!
As for a quick look, the @Last Film&Stage ruby seems to do the trick- but comes in quite unhandy right now. Clicking on camera, choosing "look through camera" and after selecting the scene through a dynamic component it jumps out of the camera.. And it's a bit slow too.
But i just gave it 15 min, i'll have a closer look later.
Overall it's probably impossible to use any other ways of presenting but sticking to the essential sketchup functions- as nobody will have the needed rubys
..what a lack of thinking of mine..
Time is running at some little project so i have to delay this, but i think it could be something somehow.
If i get it to work in a useful way, i'll post it.
TIG, i don't know much about what sketchup does behind my screen so i had to read your answer a couple of times (i am no native english speaker)
but if i understood you right, you did explain to me the way of how sketchup handles camera information and therefore how to place a component relative to that information.
So maybe there could be a more direct and easier option to achieve that than the @Last solution.
I'll have a look at Al Hart's "Align Camera" thread again later..Is there a chance of "programming" this getting-camera-information-and-placing-component-relatively into a dynamic component? Then there would be no need of a ruby..
Heading to the steakhouse now
-
I've got a few snippets of code I could send you if you want to dig through them.
Does it have to really be a sketchup component? Or can it just look like a navigation wheel? A few of us have played a LOT with the draw methods. You probably can do exactly what you want with those. If interested, I'll PM you an example or two.
Chris
Advertisement