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 / Maxscript 2010 bug - reading transform values
  RSS 2.0 ATOM  
2 pages: 1.2 first

Maxscript 2010 bug - reading transform values
Rate this thread
 
36619
 
Permlink of this thread  
avatar

Ok, Ive tried with patience about max 2010 and transform values, but NOW I need this to work. No matter which machine I go on 32-bit or 64-bit, executing a maxscript, reading transform values, in max 2010 returns [0,0,0].

Am I going crazy or am I not the only one with this HUGE problem?



Replies: 0
avatar

f.ex. this line of code:

--freeze transform as function
fn FreezeTransform item =  
 
(  
 local CurObj 
item 

 
if classof CurObj.rotation.controller != Rotation_Layer do
 
(

 
-- freeze rotation 
 CurObj
.rotation.controller Euler_Xyz()  
 CurObj
.rotation.controller Rotation_list()  
 CurObj
.rotation.controller.available.controller Euler_xyz()  
 
 
/* "Localization on" */  
 
 
CurObj.rotation.controller.setname 1 "Frozen Rotation"  
 
CurObj.rotation.controller.setname 2 "Zero Euler XYZ"  
 
 
/* "Localization off" */  
 
 
CurObj.rotation.controller.SetActive 2  
 )
 
if classof CurObj.position.controller != Position_Layer do
 
(

 
-- freeze position
 CurObj
.position.controller Bezier_Position()  
 CurObj
.position.controller position_list()  
 CurObj
.position.controller.available.controller Position_XYZ()  

 
/* "Localization on" */  
 
 
CurObj.position.controller.setname 1 "Frozen Position"  
 
CurObj.position.controller.setname 2 "Zero Pos XYZ"  
 
 
/* "Localization off" */  
 
 
CurObj.position.controller.SetActive 2  

 
-- position to zero
 CurObj
.Position.controller[2].x_Position 0
 CurObj
.Position.controller[2].y_Position 0
 CurObj
.Position.controller[2].z_Position 0
 )

 )

(
vertSplines 
= $
 
count vertSplines.count

honzLine 
SplineShape pos:vertSplines[1].pos name:"honzLine"
spln addNewSpline honzLine

vertPoints 
#()

for i in 1 to count do
(
 
--vertPoints
 p 
point size:2 wirecolor:green cross:false box:true name:("vertPoint"+as string)
 FreezeTransform p
 p
.position.controller.Available.controller Path_Constraint path:vertSplines[i] follow:true loop:false
 deleteKeys p
.position.controller.Path_Constraint.controller.percent.keys #allKeys
 
 
append vertPoints p
 
 
--creating honzLine from vertPoint pos
 addKnot honzLine spln 
#smooth #curve vertSplines[i].pos vertSplines[i].pos vertSplines[i].pos
)

updateShape honzLine
converttosplineshape honzLine

--add spline IK to honzLine
IK_Mod 
Spline_IK_Control linktypes:2   
addmodifier honzLine IK_Mod

--create the helpers
IK_Mod
.createHelper count

for i in 1 to count do
(
 
--adjusts size
 IK_Mod
.helper_List[i].size 1
 
 
--change the helper name
 tmpStr 
IK_Mod.helper_List[i].name
 tmpStr 
("honzLineP_"+as string)
 IK_Mod
.helper_List[i].name tmpStr
 
 
--transform helpers to vertPoints
 IK_Mod
.helper_List[i].transform vertPoints[i].transform
 
 
--parenting to vertPoints
 IK_Mod
.helper_List[i].parent vertPoints[i]
)

)

select some splines and execute the code. This should get the newly created line to constricted to the splines, but maxscript doesn’t transform the IK helpers to the vertPoints.



Replies: 0
2 pages: 1.2 first