Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: postjudice on October 16, 2014, 11:12:17 AM

Title: Get Vertex Position
Post by: postjudice on October 16, 2014, 11:12:17 AM
I've been trying to export vertex constraints from Maya with no avail, now I'm trying to get vertex position then set position an empty game object so that it follows the constraint as I displace the mesh.  Thoughts?
Title: Re: Get Vertex Position
Post by: postjudice on October 16, 2014, 11:13:29 AM
almost like a boat floating on water, but on a spherical ocean with many objects
Title: Re: Get Vertex Position
Post by: escpodgames on October 16, 2014, 03:41:15 PM
I made a get vertex positions into array (with array maker) action - I think it is included in the package, give that ago.
Title: Re: Get Vertex Position
Post by: postjudice on October 16, 2014, 10:25:44 PM
could you be a little more specific?  There isn't much documentation on arraymaker.

I need to dump the vertex indices into an array list first?  Then I set position based on the indices?
Title: Re: Get Vertex Position
Post by: escpodgames on October 16, 2014, 11:29:36 PM
On sale today only is this package on the asset store https://www.assetstore.unity3d.com/en/#!/content/16318

Otherwise there is a 'get vertex position action' if you know the Vertex ID
Title: Re: Get Vertex Position
Post by: postjudice on October 17, 2014, 12:20:19 AM
yea that's nice, but I'm pretty sure playmaker should be able to get me there.   

Say for instance, I know my vertex ID is 10,

Do I add a FSM GetVertexPosition index 10?  I store this in a global variable?

Can I just apply FSM to object, then SetPosition to the global variable?





Title: Re: Get Vertex Position
Post by: postjudice on October 17, 2014, 01:03:00 AM
It works partially, I'm able to parent the game object to a vertex, but it doesn't update at runtime so the object stays static, and doesn't ride the displacement.
Title: Re: Get Vertex Position
Post by: escpodgames on October 17, 2014, 02:01:36 AM
If you're are getting and setting with both set to everyframe it should follow :S
Title: Re: Get Vertex Position
Post by: postjudice on October 17, 2014, 02:08:02 AM
this may be a bug?
Title: Re: Get Vertex Position
Post by: postjudice on October 17, 2014, 02:13:26 AM
would the fact that the shader is displacing the mesh make a difference?  It behaves correctly when translating the parent.
Title: Re: Get Vertex Position
Post by: postjudice on October 17, 2014, 09:05:12 AM
So I might need to drive displacement through a geometry shader not vertex shader, does this make sense
Title: Re: Get Vertex Position
Post by: postjudice on October 19, 2014, 06:03:28 PM
Still wondering,

Can someone illustrate the process of storing an array of mesh vertices and parenting an object to one of the ID's? 

Thanks!!
Title: Re: Get Vertex Position
Post by: jeanfabre on October 20, 2014, 06:44:58 AM
Hi,

 what custom actions are you using for this?

I have a set of actions for this within ArrayMaker, you can get positions, and then modify them, to then set positions, and it works.

ArrayListGetVertexPositions
ArrayListSetVertexPositions

https://hutonggames.fogbugz.com/default.asp?W715

 Bye,

 Jean
Title: Re: Get Vertex Position
Post by: postjudice on October 20, 2014, 08:20:19 AM
I'm using arrayListGetVertexPositions, but failing to see how to set up the fsm and proxy game object, given that the example file isn't quite what i'm looking for. 

I'll keep trying
Title: Re: Get Vertex Position
Post by: postjudice on October 20, 2014, 10:15:57 AM
I'm also not sure how arrayListSetVertexPositions is helpful in this instance, since I want to just set an object's position on a vertex every frame. 

And just to re-iterate, I'm displacing with a procedural texture, and I suspect that somehow this is not a allowing the mesh indices to update in world space.
Title: Re: Get Vertex Position
Post by: postjudice on October 21, 2014, 09:26:31 AM
Update, it appears you can't access the gpu vertex calculations, so some other method is required to duplicate the calculation....
Title: Re: Get Vertex Position
Post by: jeanfabre on October 22, 2014, 02:25:43 AM
Hi,

If vertex is not modified by the shader, then you can use arrayListGetVertexPositions and then get the position of a given vertex and set the position of gameobject to be that.

 that would work ( outside your issue with gpu vertex calculation)

Bye,

 Jean
Title: Re: Get Vertex Position
Post by: postjudice on October 25, 2014, 06:20:05 PM
thanks, but if anyone has any experience with accessing mesh level vertices and duplicating the shader calculation, that would be marvelous.

Regards
Title: Re: Get Vertex Position
Post by: postjudice on November 13, 2014, 09:01:03 AM
BUMp! 8)
Title: Re: Get Vertex Position
Post by: jeanfabre on November 17, 2014, 08:03:25 AM
Hi,

You will have more chance to get an answer on Unity's forum or UA, I personally have no experience with shaders.

 Bye,

 Jean