Mod Tool/Scripting: Difference between revisions

how to get position of objects (moving and sorting more content from MT main page)
(how to get position of points (moving and sorting more content from MT main page))
(how to get position of objects (moving and sorting more content from MT main page))
Line 1,295: Line 1,295:


==3D mesh==
==3D mesh==
'''Bounding box values'''
===General mesh information===
====Bounding box values====
  ' this could be useful to create a bounding box for [[OBD_talk:OFGA#XML|OFGA files]]
  ' this could be useful to create a bounding box for [[OBD_talk:OFGA#XML|OFGA files]]
   
   
Line 1,315: Line 1,315:
  ' INFO : Lower Bound: -1 / -2 / -1
  ' INFO : Lower Bound: -1 / -2 / -1
  ' INFO : Upper Bound: 1 / 2 / 1
  ' INFO : Upper Bound: 1 / 2 / 1
====Get the scaling, rotation and position of selected objects====
logmessage "mesh name: " & selection(0)
logmessage selection(0).sclx.value
logmessage selection(0).scly.value
logmessage selection(0).sclz.value
logmessage selection(0).rotx.value
logmessage selection(0).roty.value
logmessage selection(0).rotz.value
logmessage selection(0).posx.value
logmessage selection(0).posy.value
logmessage selection(0).posz.value
====Get scaling, rotation, and position of not selected objects====
' GetValue("NAME.kine.global.rotx")
' NAME must be the exact mesh name
' let's say you want the data of one character's pelvis
logmessage GetValue("pelvis.kine.global.sclx")
logmessage GetValue("pelvis.kine.global.scly")
logmessage GetValue("pelvis.kine.global.sclz")
logmessage GetValue("pelvis.kine.global.rotx")
logmessage GetValue("pelvis.kine.global.roty")
logmessage GetValue("pelvis.kine.global.rotz")
logmessage GetValue("pelvis.kine.global.posx")
logmessage GetValue("pelvis.kine.global.posy")
logmessage GetValue("pelvis.kine.global.posz")


===Points===
===Points===
===Get position of points (with selection mode point)===
====Get position of points (with selection mode point)====
  ' a point must be selected
  ' a point must be selected
  ' gets xyz position of first selected point of the first selected object
  ' gets xyz position of first selected point of the first selected object
Line 1,324: Line 1,352:
  logmessage Selection(0).SubComponent.ComponentCollection(0).position.z
  logmessage Selection(0).SubComponent.ComponentCollection(0).position.z


===Get position of points (with selection mode object)===
====Get position of points (with selection mode object)====
  ' an object must be selected
  ' an object must be selected
  ' gets xyz position of point 0 of the first selected object
  ' gets xyz position of point 0 of the first selected object
Line 1,331: Line 1,359:
  logmessage selection(0).activeprimitive.geometry.Points(0).Position.z
  logmessage selection(0).activeprimitive.geometry.Points(0).Position.z


===Get and set position of points (without selection) right after object creation===  
====Get and set position of points (without selection) right after object creation====
  ' point positions are relative to the object's center
  ' point positions are relative to the object's center
  ' to get the absolute point positions add center to point
  ' to get the absolute point positions add center to point
Line 1,373: Line 1,401:




===Get global point position===
====Get global point position====
  set oObj = selection(0)
  set oObj = selection(0)
  set oTrans = oObj.Kinematics.Local.Transform  
  set oTrans = oObj.Kinematics.Local.Transform  
8,323

edits