Notifications
Clear all

[Closed] LookAt one axis Maxscript?

Hi I wonder how to do LookAt constraints in max script but it should only follow in one axis like up and down not follow left and right, and without using look in Link info.

thanks in advance

18 Replies

If you search CgTalk, I asked the same question about a year ago and got a good response.

 PEN

You don’t really need mxs to do this.

Create a point name:p1
Create second point and align to p1 and call it p2
Link p1 to p2

Add a lookat con to p1 and target what you need
Create expose transform helper and expose p1

Now you can wire what ever you want to the exposed local Euler angles to get the axis that you need. Set the axis order if you need to correct for fumble if y is the axis that you want to wire to.

2 Replies
(@patan77)
Joined: 11 months ago

Posts: 0

Im very new to rigging and stuff in that area so I don’t really get how I should do that^^,
I’m going to use the lookAt in this control panel on this light: http://forums.cgsociety.org/showthread.php?p=7127423#post7127423

I’m trying to do pick object then the light(in the thread/link above) should follow/look at that object.

and btw are you the creator of the Intermediate Rigging 3Ds max dvd tutorials? (:

(@denist)
Joined: 11 months ago

Posts: 0

it might be a paranoia but i don’t like to use the exposeTM helper. this helper wants to say me that i’m not good enough in Matrix Algebra.
Screw you! I have a Master Degree in math… keep this gift for anyone else.

the TzMtN’s method is the way that i would do:
http://forums.cgsociety.org/showpost.php?p=6596038&postcount=3

Here’s a link to the thread I mentioned earlier
http://forums.cgsociety.org/showthread.php?f=98&t=899758

 PEN

The expose TM works very well and is faster in tests then using a script controller that extracts the value in tests that I did. I wish I had a math degree as it would have saved me trying to learn all the math in my 30’s and 40’s:(

Yes I am the creator of those dvd’s

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

actually just next day after you posted the way of doing the constraint with ExposeTM i spent couple hours to refresh my memory about this Helper.
it works. and it works pretty well. i tried to redo some my scripted controllers using ExposeTM but… i didn’t find a one.
i’m OK to add extra node to my rig, but i don’t want to make it more complicated. i don’t like to add a node to the rig if the node doesn’t make any sense for the user.
if i could add ExposeTM itself as its localReferenceNode it would change the situation.

anyway… thanks PEN for pushing me view this Helper new way.

Thank you I did as you said and it worked really great, to implement it to my rig i had to parent and wire a little differently, and add some scripting but  I did basically the same thing. 

check [b]video [/b]of how the rig works now: [ http://www.patan77.com/video/movinghead03.mp4 ]( http://www.patan77.com/video/movinghead03.mp4) 

cool that you have created those dvd's I have seen dvd 1 and 2 (: really good 

I'm still working  to get the rig to behave as I want it to . so to do that that I want to add and remove lookat constraint with max script how would I do that?

I have tried this macro and It add lookat  but isn't there a better way to add, and remove?

[color=DeepSkyBlue][color=RoyalBlue]select [/color][/color]$P1
macros.run "Constraints" "LookAt"
$.rotation.controller.LookAt_Constraint.controller.target_axisFlip = [color=RoyalBlue][b]on[/b][/color]

thanks in advance (:
 PEN

Look up the lookAt constraint in the help file and it will tell you every thing.

b=box()
c=circle pos:[100,0,0]
lookAtCon=lookAt_Constraint()

showInterfaces lookAtCon --Look at the listener
showProperties lookAtCon --Look at the listener

lookAtCon.appendTarget c 100
lookAtCon.target_axisFlip=true

rotList=rotation_list()
b.rotation.controller=rotList
rotList.available.controller=lookAtCon
1 Reply
(@patan77)
Joined: 11 months ago

Posts: 0

Works like a charm =D thank you

but how should I do to remove/delete the lookAt constraint?
because I have when I pick object It adds the constraint and when I right click I want it to remove the constraint, but right now I just have that it removes the target.

on followobjPb rightclick do
(
$P1.rotation.controller.LookAt_Constraint.deleteTarget(1)
$Circle013.modifiers [1].MovingHeadLampControls.followobj = undefined
)

 PEN

Can I suggest that you read the help as that tells you how very clearly.

1 Reply
(@patan77)
Joined: 11 months ago

Posts: 0

ok wanna link to right section to read?

Would you like him to wipe your bum too?

Assigning a different controller will get rid of the lookat. Maybe see what controller is on it before you assign the lookat, and then just reassign one of those.

You should and if you’re serious about scripting in max, you will spend more time with the Maxscript help than with your significant other.

Page 1 / 2