Export object placement (bf 3dsmax script)

Ask questions, discuss ideas, get answers

Export object placement (bf 3dsmax script)

Postby reegad » Sun Sep 01, 2019 11:05 am

Trying to export some object placements, i get the position and rotation but the name of the object does not show.
Anyone ran in to this problem?

Object.create
Object.absolutePosition 45.1857/0.0/-23.8778
Object.rotation 0.0/0.0/0.0

This is the code from the objectPlacing,ms script,
Code: Select all
   on objsButton pressed do
   (
      number_of_items =  selection.count
      fname = getSaveFileName caption: "Save BF Static objects list File" types:" .con|*.con|"
      if fname != undefined then
      (
         f = createfile fname
         for item_number = 1 to number_of_items do  --sets up the loop for each entry
         (
            s = selection[item_number]

            theMatrix = s.rotation as matrix3
            pitch = asin(-theMatrix.row3.y)
            roll = -acos(theMatrix.row3.z/(cos(pitch)))
            roll2 = asin(theMatrix.row3.x/(cos(pitch)))

            if roll2 > 0 do roll = -roll
            if ( abs(roll) > 100000 ) do roll = 0

            yaw = -acos(theMatrix.row2.y/(cos(pitch))) -- valid for 180
            yaw2 = asin(theMatrix.row1.y/(cos(pitch))) -- valid for 90 270

            if yaw2 > 0 do   yaw = -yaw
            if ( abs(yaw) > 100000 ) do yaw = 0

            tx = (s.position.x)
            ty = (s.position.y)
            tz = (s.position.z)

            try   theName = ( substring s.name 1 ((findstring s.name (rmsuffix_txt.text as string))-1) )
            catch theName = s.name

            format "\nrem ***  \nObject.create %%%\nObject.absolutePosition %/%/%\nObject.rotation %/%/%\n" \
             prefix_txt.text theName suffix_txt.text tx tz ty yaw pitch roll to:f
         )
         print ("Saved: "+(fname as string))
         close f
      )
Image
reegad
 
Posts: 76
Joined: Mon Nov 09, 2009 3:43 pm

Return to 1942 Modding Discussion

Who is online

Users browsing this forum: Majestic-12 [Bot] and 45 guests

cron