Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / How to find syntax for values out of an object
  RSS 2.0 ATOM  

How to find syntax for values out of an object
Rate this thread
 
56121
 
Permlink of this thread  
avatar
  • Total Posts: 13
  • Joined: 31 January 2008 07:28 PM

New to MAXScript and am having a hard time determining the syntax for how to get values out of an object depending upon what controller(s) are on it.

For example, create a box - and I can get its Z rotation like this:
$Box001.rotation.controller.Z_Rotation

But put an orientation constraint on it, and through trial and error I can’t figure out how to now get the rotation values from that object?

In MAXScript Listener window I’m fumbling around like this:

$Box001.rotation.controller
Controller:Orientation_Constraint
$Box001.rotation.controller.Z_Rotation
-- Unknown property: “z_rotation” in Controller:Orientation_Constraint
$Box001.rotation.controller.Z
-- Unknown property: “z” in Controller:Orientation_Constraint
$Box001.rotation.controller.orientation_constraint
-- Unknown property: “Orientation_Constraint” in Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller
Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller.Z
-- Unknown property: “z” in Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller.rotation
-- Unknown property: “rotation” in Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller.orientation_constraint
-- Unknown property: “Orientation_Constraint” in Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller.orientation_constraint
-- Unknown property: “Orientation_Constraint” in Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller.orientation_constraint.weight[1]
-- Unknown property: “Orientation_Constraint” in Controller:Orientation_Constraint
$Box001.transform.controller.rotation.controller.Z_Rotation
-- Unknown property: “z_rotation” in Controller:Orientation_Constraint
$Box001.rotation.controller[#x_rotation].controller.value$Box0
-- Unknown property: “controller” in undefined

There has to be an easier way!

BTW - my question isn’t specific to orientation constraint - but more general that how do I find the syntax for any controller or combination of controllers for any value?  The documentation has some properties and some methods, but it doesn’t seem to be documented???

Many thanks!



Replies: 1
/img/forum/dark/default_avatar.png

exprForMAXObject() ?

tvp trackview.pickTrackDlg()
if 
tvp != undefined do
    
exprForMAXObject tvp.anim
Author: Anubis

Replied: 23 May 2011 09:39 AM  
avatar
  • amarhys
  • Posted: 23 May 2011 10:13 AM

You can also use

getPropNames $.rotation.controller

which returns for basic controller

#(#axisOrder, #x_rotation, #y_rotation, #z_rotation)

or returns for orientation constraint controller

#(#weight, #relative, #local_world)

Hope it will help.

-amarhys



Max 2011, Win7-Pro 64.
NVidia GeForce GTX 460
Core i7 950 3.06Ghz, 24Gb Ram.

Replies: 0
avatar

Anubis - thanks, but I have no clue what that means or how to use it...???  :)

Amarhys - yes this is helpful, but I’m unclear where to go next.  If I put an orientation controller on an object I get:

getPropNames $Box001.rotation.controller
#(#weight, #relative, #local_world)

So what next?  How do I get the object’s rotation values?  I’m unclear how to go from what getPropNames give me to figure out syntax to get values.



Replies: 1
/img/forum/dark/default_avatar.png

Looks like your question is modified now…
“How do I get the object’s rotation values?”

obj.rotation.controller.value

[edit] if that would help…

objA Box()
objB Box pos:[40,0,0]
oc 
Orientation_Constraint()
objA.rotation.controller oc
oc
.appendTarget objB 100

rotate objB 45 z_axis
rot1 
objA.rotation.controller.value --> (quat 0 0 -0.382683 0.92388)
rot2 objA.transform.rotation --> (quat 0 0 -0.382683 0.92388)
rot3 objA.rotation --> (quat 0 0 0.382683 0.92388)
rot4 objA[3][2].value --> (quat 0 0 -0.382683 0.92388)
rotZ objA.rotation.z_rotation --> 45.0
Author: Anubis

Replied: 25 May 2011 05:17 AM