Help with Javascript to transform vector structure triangle into collider triangle structure.

axlrecords's picture

I made a composition using the Carasuelo Open CV . I use the Convex Hulls structure result of the above patch and transformed into vector with "kineme vector with line structure" patch and then I close the vector with the "Kineme vector close" patch. I scaled the vector with the "Kineme vector transform" and scale it 1 to 1. A this point I use the "Kineme Extrusion with vector" in order to get a structure of triangles that is the result of the extrusion of the shape coming out from the Carasuelo. The structure result is suitable for a GL Triangle structure render. My goal is to feed this structure into a Kineme collider triangle but the point is that the structure result is made by member that contain 6 elements, 3 of that are the XYZ position of every vertex of the triangles, while the collider needs a one dimensional array with the xyz position of every vertex. I don't have any clue in how to write a java script that convert the structure I have as a result of the vector transformation in a structure suitable for the collider patch. Please see the two type of structures in the jpg attached. The struct vector jpg is the type of structure that needs to be transformed into the type of structure of the struct collider jpg. Does some one can help me ? THX

PreviewAttachmentSize
struct collider.jpg
struct collider.jpg132.71 KB
struct vector.jpg
struct vector.jpg90.82 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

jersmi's picture
Re: Help with Javascript to transform vector structure ...

You could maybe try skipping the javascript and using instead Structure Key Member to get the X,Y,Z and feed the to a Kineme Structure Maker to create the single triangle structure you need.

axlrecords's picture
Re: Help with Javascript to transform vector structure ...

I've been trying with the kineme structure patchs but the structure has to many point in it, so unpacking the structure and than remaking in the way I need, it will need's many actors. The result is a drastic reduction in speed of the composition. I also feed the structure into an iterator unpacking/remaking and forward the results into a spooky send out of the iterator but still the composition is running dramatically low , sometimes crash of course. Thanx anyway