Mod Tool: Difference between revisions

2,268 bytes added ,  4 September 2012
m
getting position of points
m (/wait)
m (getting position of points)
Line 284: Line 284:
|-
|-
| [22] UserDataBlob
| [22] UserDataBlob
| [23]
| [23] getting the position of points (with selection mode point)
| [24]
| [24] getting the position of points (with selection mode object)
|-
| [25] getting and setting the position of points (without selection)
|
|
|}
|}


Line 580: Line 584:
  ' the so-called "UserDataBlob" can't be saved in *.dae, so save the whole scene to keep your progress
  ' the so-called "UserDataBlob" can't be saved in *.dae, so save the whole scene to keep your progress
  ' [...]
  ' [...]
' '''[23] getting the position of points (with selection mode point)'''
' for point selection mode, a point must be selected
' gets xyz position of first selected point of the first selected object
logmessage Selection(0).SubComponent.ComponentCollection(0).position.x
logmessage Selection(0).SubComponent.ComponentCollection(0).position.y
logmessage Selection(0).SubComponent.ComponentCollection(0).position.z
' '''[24] getting the position of points (with selection mode object)'''
' for object selection mode, an object must be selected
' gets xyz position of point 0 of the first selected object
logmessage selection(0).activeprimitive.geometry.Points(0).Position.x
logmessage selection(0).activeprimitive.geometry.Points(0).Position.y
logmessage selection(0).activeprimitive.geometry.Points(0).Position.z
' '''[25] getting and setting the position of points (without selection) right after object creation'''
' those are relative position calculated from the objects center
' to get the real positions add relative poition to that center position
' don't confuse this with the center that can be moved around
' it's the mathematical center of the object
set oRoot = application.activeproject.activescene.root
set oObj = oRoot.addgeometry( "Cube", "MeshSurface", "TRGV" )
logmessage "TriggerVolumes." & oObj
FreezeObj oObj
set oGeometry = oObj.activeprimitive.geometry
aPositions = oGeometry.Points.PositionArray
'                  xyz, 0  = value
logmessage aPositions(0, 0)
logmessage aPositions(1, 0)
logmessage aPositions(2, 0)
' changing x position of point 0 to value -12
aPositions(0, 0) = -12
' you can add more changes here
' update the array
oGeometry.Points.PositionArray = aPositions
' apply the changes for point 0 (in this we changed only x dimension to -12)
Translate oObj, aPositions(0, 0), aPositions(1, 0), aPositions(2, 0), siAbsolute, siView, siCtr, siXYZ, , , , , , , , , , 0
SaveKey oObj & ".kine.local.posx," & _
oObj & ".kine.local.posy," & _
oObj & ".kine.local.posz", 1, , , , True




8,452

edits