How to retrieve the vector value of a specific vertex at a certain point on the timeline?

var target_vertex_index = 21616;var frame_range = [0, 4];var time_step = Scene.getTimeStep().valueOf();var start_time = frame_range[0] * time_step;var end_time = frame_range[1] * time_step;var geometry = Scene.getPrimarySelection().getObject().getCurrentShape().getGeometry();for (var i = start_time; i <= end_time; i += time_step) {	Scene.setTime(i);	var target_vector = geometry.getVertex(target_vertex_index);	print('[%1] target_vector: %2'.arg(i).arg(target_vector));}

I ran the script above to observe the change in the vector value for a fixed vertex index on a character with animation applied.

However, the result outputs the same value.

Is there a way to properly retrieve the vector value of a specific vertex as time progresses?

Thanks in advance.

Comments

  • algovincianalgovincian Posts: 2,625

    I believe you need to call Scene.getPrimarySelection().getObject().getCachedGeom(). Also, I believe you need to call Scene.update() after Scene.setTime(i) inside the loop.

    HTH.

    - Greg

  • t_20080808t_20080808 Posts: 0
    edited January 5

    algovincian said:

    I believe you need to call Scene.getPrimarySelection().getObject().getCachedGeom(). Also, I believe you need to call Scene.update() after Scene.setTime(i) inside the loop.

    HTH.

    - Greg

    Yes, you are so helpful, I 've  got the same problem for two days. Just like you said , I can do just like:

    var oGeo = Scene.getPrimarySelection().getObject().getCachedGeom();
    Scene.update(); 
    vecVert = oGeo.getVertex(1024);
    print(vecVert);
    Post edited by Richard Haseltine on
  • Richard HaseltineRichard Haseltine Posts: 101,805

    Ideally don't string them all together like that - it will make bug trapping much harder.

Sign In or Register to comment.