Jump to content

Make object face towards viewport


Zero

Recommended Posts

I'm sure this is trivial and I am completely missing something, so I do apologise in advance, but I just can't figure out how to do this:

I have an object, that I want to act like a "sprite", i.e. I need it to always point towards the camera of the viewport. That is, not a proper camera object, but rather whatever "camera" is being used to look at the scene in the 3D viewport. I hope that makes sense. So, as the user tumbles the viewport, the object needs to rotate along such that it always faces the current point of view.

Any help will be much appreciated.

P.S. I did search in the forums before posting, but all I found was a topic on how to make point normals face a given camera object.

Link to comment
Share on other sites

There is a Look At parameter on your geometry object. Just add the camera there.

Well, as I said, I don't want it to point at an existing object in my scene, I want it to point at whatever position the scene is being looked at though the viewport.

Link to comment
Share on other sites

Well, as I said, I don't want it to point at an existing object in my scene, I want it to point at whatever position the scene is being looked at though the viewport.

Ohh sorry. Totally missread.

Maybe you can use viewTransform from

http://www.sidefx.com/docs/houdini11.0/hom/hou/GeometryViewport

in a python expression in a Null node to make it always positioned where the viewport is and then use the look-at pointing at that.

Link to comment
Share on other sites

just a suggestion (I don't know if it works!!):

There's an output from global variables node in VEX SHOP! (I don't know how to get it in vopsop!) called _I (Direction from Eye) which give you a vector, which is a vector from eye to each point of the object, maybe you can use it if you can somehow bring it to vopsop!

Edited by ehsan parizi
Link to comment
Share on other sites

I found the GeometryViewport interface just before reading Erik_JE's suggestion (thanks!) -- and I did manage to put together some expressions to get the rotation matrix of the viewport. It works, in the sense that I can orient an object to point at the viewport, the problem is, that when the user tumbles the viewport, the expression is not re-evaluated. If I re-cook the operator, the object turns to look at the viewport again, but it requires a re-cook.

For now that's good enough, but I am considering looking into using the HDK to draw what I want in OpenGL. That should overcome this limitation and actually would also solve other issues I have with my current design.

Thanks everyone for your suggestions!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...