RickWork Posted February 22, 2006 Share Posted February 22, 2006 Hi, Is there a way to mimic the LookAt in SOPS? I have a bunch of boxes copied to every point on a grid and I want them to look at a null that's animated in xyz. I tried messing with the lookat in the primitive Sop but I don't think that's it. Thanks! /Rick Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted February 22, 2006 Share Posted February 22, 2006 Hello, Could you have gotten the normalof each of these points and "aim" them to the point to which you are trying to aim at? i.e.: tx = $TX-point("../lookAtPt", 0, "P", 0) ty = $TY-point("../lookAtPt", 0, "P", 1) tz = $TZ-point("../lookAtPt", 0, "P", 2) This will allow your boxes to aim at that lookat point when you copy them to the point where its normal is looking. You might also want to set an up vector to those aim points to prevent flipping tho. HTH, Alex Quote Link to comment Share on other sites More sharing options...
RickWork Posted February 22, 2006 Author Share Posted February 22, 2006 I don't think that'll work becuae alll the copies have the same orientation Quote Link to comment Share on other sites More sharing options...
exel Posted February 22, 2006 Share Posted February 22, 2006 I don't think that'll work becuae alll the copies have the same orientation 24987[/snapback] Yeah I'm with Alex on this one -- set your point normals and up vectors on your copy SOP's template geometry, then copy w/ "rotate to normals" on... you can object merge your camera into the SOP network and use a point SOP to subtract the point position on the camera from your template's point positions, that should give you vectors pointing at the camera... Quote Link to comment Share on other sites More sharing options...
exel Posted February 23, 2006 Share Posted February 23, 2006 I just whipped up this cheesy example, hope this helps... SOP_copy_simple_lookat.1.hip Quote Link to comment Share on other sites More sharing options...
RickWork Posted February 23, 2006 Author Share Posted February 23, 2006 Yup that works great. Sorry my brain wasn't working when I read your post. Thanks! /Rick Quote Link to comment Share on other sites More sharing options...
RickWork Posted February 27, 2006 Author Share Posted February 27, 2006 Actually I spoke to soon. It seems that the objects can't look behind them, only infront of them when using a copy sop. I tried this with a single point and it works just fine as I expect but once I use a copySOP, the normals can all only point one way for orientation? Can anybody help here? I've attached a file where I try to orient the copys based on their relative position. Thanks! /Rick RW_LookAT.hip Quote Link to comment Share on other sites More sharing options...
RickWork Posted February 28, 2006 Author Share Posted February 28, 2006 Actually nevermind Once again my brain wasn't working. I forgot to check if the values were negative. I have attached the working file. RW_LookAT_Working.hip Quote Link to comment Share on other sites More sharing options...
exel Posted February 28, 2006 Share Posted February 28, 2006 Actually I spoke to soon.It seems that the objects can't look behind them, only infront of them when using a copy sop. I tried this with a single point and it works just fine as I expect but once I use a copySOP, the normals can all only point one way for orientation? Can anybody help here? I've attached a file where I try to orient the copys based on their relative position. Thanks! /Rick 25156[/snapback] One thing I spotted right away is the expressions in your point SOP, I changed: $TX+($TX2-$TX) to ($TX2-$TX) and that changed everything... Another problem I think you're having is that you're copying that grid of points to your incoming null object, and it's the same scale -- your grid of points is "looking at" another grid of points that's just offset in space a little, hence the normals your computing are all parallel. Simplest fix would be to scale the grid down to zero before it's wired into your copy SOP, then all your normals will be converging on one single target... Here's your .hip file back with a few slight tweaks, is this more what you want? -JS- RW_LookAT.2.hip Quote Link to comment Share on other sites More sharing options...
exel Posted February 28, 2006 Share Posted February 28, 2006 Woops, missed your most recent post Rick... Quote Link to comment Share on other sites More sharing options...
RickWork Posted February 28, 2006 Author Share Posted February 28, 2006 haha I'm having some day or rather a mind trick on this. Once again I thought I had it but didn't. The problem with $TX2-$TX is that all the copies look at the null at the same time rather than with an offset of their relative position. Know what I mean? When I do this this operation in say maya, each object will turn to look at the null from their initial position so there will be a random look to them. So I thought I had it fixed in the fille I attached above called "working" but negating the expression if the values were negative but that wasn't it. yep, I'm confused. Quote Link to comment Share on other sites More sharing options...
exel Posted February 28, 2006 Share Posted February 28, 2006 haha I'm having some day or rather a mind trick on this.Once again I thought I had it but didn't. The problem with $TX2-$TX is that all the copies look at the null at the same time rather than with an offset of their relative position. Know what I mean? When I do this this operation in say maya, each object will turn to look at the null from their initial position so there will be a random look to them. So I thought I had it fixed in the fille I attached above called "working" but negating the expression if the values were negative but that wasn't it. yep, I'm confused. 25160[/snapback] Ohhh, I thought you didn't want that effect... I'm sort of confused as well... I'm quite sure that what you're looking for can be done, but I don't quite get what you're after. So you don't want all the copies to be aimed at a single point in space? Do you want them all to be parallel to each other and all aiming together in the direction of the target object? And I'm not sure why the copies wouldn't turn to look behind them (as long as the target object was behind them), but again I might not be understanding what you're looking for... Quote Link to comment Share on other sites More sharing options...
RickWork Posted February 28, 2006 Author Share Posted February 28, 2006 you know what.... I had to just walk away from the computer and take a brain break. You are absolutly right. My mistake sorry. The file you posted is exactly what I wanted. What I was thinking was to have the guys way out in the distance falloff, like have them adjust their position at 1/2 the speed they normally would if they were say 5 units away from the null. I guess I can use the pointdist function for this. Thanks and sorry again for the mix up. /Rick Quote Link to comment Share on other sites More sharing options...
exel Posted February 28, 2006 Share Posted February 28, 2006 What I was thinking was to have the guys way out in the distance falloff, like have them adjust their position at 1/2 the speed they normally would if they were say 5 units away from the null. I guess I can use the pointdist function for this. 25163[/snapback] Ohhh OK, gotcha... well having those copies change their orientations at different speeds is another thing entirely... a lot more complex, but it can certainly be done, no problem... you'd probably need to pipe your source points and your target position into CHOPs, where you can do some work on the channels, like adding lag and stuff... Quote Link to comment Share on other sites More sharing options...
RickWork Posted March 6, 2006 Author Share Posted March 6, 2006 Hello, Sorry to bring this up again but I've been racking my brain on this for about 2 weeks. How would I go about's decreasing this effect over distance and time from a point (like 1 frame and 1 unit) or something like that. Essentially I would like to have each point aim at a null 1 after the other based on how far they are from a certain point. I did try creating an attribute called DIST which is the distance from each point to a sphere in the scene. I'm using the pointdist() function. What I wanted is as the sphere is closer to some points on my grid, I would like this "aiming" to the null to happen and as the sphere is further away from the grid points I want the effect fade off. Ideally I'm just looking to offsset the aim over space and time. In my pointSOP I have the expression: ($TX2-$TX) / $DIST But that doesn't "appear" to be working per point. In the spreadsheet I can see the $DIST attr evalute properly for each point so I'm confused why the above expression doesn't work. I did look at the object chop to compute distance but I don't see how I could lag points based off of distance and time. Thanks Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted March 6, 2006 Share Posted March 6, 2006 Hello, Perhaps you need to multiply/divide your vector by a smooth falloff so that at certain distance, the magnitude of a vector is less/more? i.e. ($TX2-$TX) * smooth($DIST, $MYMINDIST, $MYMAXDIST) ? -Alex Quote Link to comment Share on other sites More sharing options...
RickWork Posted March 6, 2006 Author Share Posted March 6, 2006 Thanks Alex, I'll give that a try Quote Link to comment Share on other sites More sharing options...
exel Posted March 8, 2006 Share Posted March 8, 2006 Hello,Sorry to bring this up again but I've been racking my brain on this for about 2 weeks. How would I go about's decreasing this effect over distance and time from a point (like 1 frame and 1 unit) or something like that. Essentially I would like to have each point aim at a null 1 after the other based on how far they are from a certain point. Thanks 25401[/snapback] Hey Rick, After reading your posts I came up with something that might be closer to what you need, but it still doesn't address time-based issues, only distance-based... I've attached a .hip file with comments on some of the SOPs, hope this helps! -JS- RW_LookAT.3.hip 1 Quote Link to comment Share on other sites More sharing options...
RickWork Posted March 8, 2006 Author Share Posted March 8, 2006 Hey Rick, After reading your posts I came up with something that might be closer to what you need, but it still doesn't address time-based issues, only distance-based... I've attached a .hip file with comments on some of the SOPs, hope this helps! -JS- 25477[/snapback] Thanks man. I did come up with something close to what you have there. Except my expression are way way too long. Nice elegant and clean approach you have. Thanks very much! /Rick Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.