Announcement

Collapse
No announcement yet.

Using max script to get velocity of a point

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using max script to get velocity of a point

    Hey Guys,

    I'm trying to export velocity and color of my simulation using max script functions like 'A_GetV' or 'A_GetRGB'. But it seems like not working. They returns [0, 0, 0] all the time.
    I also tried to change the coordinate system using 'A_SetSystem', but it creates error when tried to use 'A_GetV' or 'A_GetRGB' with the changed corrdinate system,
    Is there any solution about this? Any advice would be rally appreciated.

    Thanks,

  • #2
    Hey,

    Here are the docs just in case: https://docs.chaosgroup.com/display/PHX3MAX/MaxScript Please ping me if we need to update them in any way.

    By default the coordinate system is in voxel space, so 0,0,0 is the voxel at the bottom corner of the simulator. If your simulator is 100x100x100 voxels big, then the biggest voxel you can get in this system would be 99,99,99 at the top corner of the simulator. If you are using object or world, make sure to check how big the simulator is in world units.

    Could you paste the errors you are getting? They should say what the problem is.

    Also, you can call a_getv on a running simulator or on a stopped one. If the sim is stopped, you must make sure that velocity is checked on the Output rollout and is exported to the cache files. If you are getting [0,0,0], there either is no velocity at this voxel, or the velocity channel is not there - same goes for rgb

    Cheers!
    Svetlin Nikolov, Ex Phoenix team lead

    Comment


    • #3
      Hey, Svetilin.

      Thanks for your advice! The reason of my failure was the output check box setting like you said. Now I can export velocity and color, after I made the output check boxis checked. Thanks.
      However, I still could not use other coordinate system except the voxel space. I could change the coordinate to local or world space, but it shows me below error message when I tried to export the color or velocity.



      -- Error occurred in anonymous codeblock; filename: C:\Work\VolumeExportScript\Max_PhoenixVolumeExport Script.ms; position: 187; line: 8
      -- Known system exception
      -- ################################################## ######################
      -- Address: 0x6c266b8; nCode: 0x00000000C0000005
      -- Desc: EXCEPTION_ACCESS_VIOLATION The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
      -- Read of Address: 0x00000000000000B0
      -- ################################################## ######################
      -- MAXScript callstack:
      -- thread data: threadID:21784
      -- ------------------------------------------------------
      -- [stack level: 0]
      -- In i loop; filename: C:\Work\VolumeExportScript\Max_PhoenixVolumeExport Script.ms; position: 186; line: 7
      -- Parameters:
      -- i: 0
      -- Locals:
      -- i: 0
      -- Externals:
      -- owner: undefined
      -- ------------------------------------------------------
      -- [stack level: 1]
      -- called from top-level
      -- ################################################## ######################
      -- C++ callstack:
      -- (phoenixfd): (filename not available): VertexNormalsControl::VertexNormalsControl
      -- (phoenixfd): (filename not available): VertexNormalsControl::VertexNormalsControl
      -- (phoenixfd): (filename not available): VertexNormalsControl::VertexNormalsControl
      -- (MAXScrpt): (filename not available): Primitive::apply
      -- (MAXScrpt): (filename not available): CodeTree::eval
      -- (MAXScrpt): (filename not available): MappedGeneric::apply
      -- (MAXScrpt): (filename not available): CodeTree::eval
      -- (MAXScrpt): (filename not available): Primitive::apply
      -- (MAXScrpt): (filename not available): clear_error_source_data
      -- (MAXScrpt): (filename not available): Primitive::apply
      -- (MAXScrpt): (filename not available): CodeTree::eval
      -- (MAXScrpt): (filename not available): SourceFileWrapper::eval
      -- (MAXScrpt): (filename not available): Listener::set_style
      -- (USER32): (filename not available): SetWindowTextW
      -- (USER32): (filename not available): SetWindowTextW
      -- (USER32): (filename not available): SetWindowTextW
      -- (USER32): (filename not available): CallWindowProcW
      -- (USER32): (filename not available): CallWindowProcW
      -- (UIControls): (filename not available): InitializeCustomUI
      -- (UIControls): (filename not available): (function-name not available)
      -- (USER32): (filename not available): CallWindowProcW
      -- (USER32): (filename not available): DispatchMessageW
      -- (USER32): (filename not available): IsDialogMessageW
      -- (3dsmax): (filename not available): XMLAnimTreeEntry::GetType
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- (clr): (filename not available): LegacyNGenTryEnumerateFusionCache
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- (3dsmax): (filename not available): UtilGfx::kFONT_WIDTH
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- (3dsmax): (filename not available): (function-name not available)
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- (ViewSystem): (filename not available): MaxGraphics:eleteViewportViewSetting
      -- ((module-name not available)): (filename not available): (function-name not available)
      -- (clr): (filename not available): (function-name not available)
      -- ################################################## ######################



      Cheers!

      Comment


      • #4
        Hey, sorry for the late reply - would it be possible to paste the code you use when you get this error? Also, are you using the latest version 3.05, or an older one? I am trying here with a simple setup and setting the system and getting the velocity in the OnSimulationStep callback while the sim is running, but even if I go out of bounds, I just get zero velocity, but no such exception.

        Cheers!
        Svetlin Nikolov, Ex Phoenix team lead

        Comment

        Working...
        X