finding centre point of a summash



Users browsing this forum: No registered users and 1 guest

Next topic
Previous topic
Post new topic Reply to topic  NeoAxis Forum Index » General » General Discussion
Search for:
Author Message

Joined: Sun Jul 03, 2011
Posts: 40
Country: Canada (ca)
PostPosted: Mon Sep 12, 2011 3:51 am Post subject: finding centre point of a summash
Bottom of Page Back to top
Hi guys,
I have a mesh consists of many different submashes, and from a loop, I'd like to find the coordinates of each and every submashes in aspect to the big mash, and create a box which can be aligned to the centre and sides of the submashes, how can I achive that idea? Thanks a lot!

 
 Profile  
Unlimited License
Unlimited License
User avatar

Joined: Tue Sep 16, 2008
Posts: 1278
Location: Imatra
Country: Finland (fi)
PostPosted: Mon Sep 12, 2011 3:19 pm 
Bottom of Page Back to top
Best way I think is to calculate it's bounding box yourself.

Find an example of vertex manipulation and go through all vertices in the submesh.
If the vertex position is lower than the previous lowest or bigger than the previous highest, etc, that way you can make your own Bounds and get various data easily, like the center position.

_________________
if(obj as PlayerCharacter is PlayerCharacter)
 
 Profile  

Joined: Sun Jul 03, 2011
Posts: 40
Country: Canada (ca)
PostPosted: Tue Sep 13, 2011 5:18 am 
Bottom of Page Back to top
SodanKerjuu wrote:
Best way I think is to calculate it's bounding box yourself.

Find an example of vertex manipulation and go through all vertices in the submesh.
If the vertex position is lower than the previous lowest or bigger than the previous highest, etc, that way you can make your own Bounds and get various data easily, like the center position.



Thanks Sodan, I was reading articles regarding to the GetSomeGeometry function, but very few were found, I'm wondering if this is the right path to do this, what is the usage of the GetSomeGeometry function? Please advise, thank you!

 
 Profile  
Unlimited License
Unlimited License
User avatar

Joined: Tue Sep 16, 2008
Posts: 1278
Location: Imatra
Country: Finland (fi)
PostPosted: Tue Sep 13, 2011 5:50 am 
Bottom of Page Back to top
Took a look, yes that is the function, sadly only commercial license holders had examples in source code from the editors side.
But it is really simple you should have been able to see it from intellisense (taken if you use Visual Studio of course).

Here is how you can use it to your situation:
Code: Select all   Expand view
            List<Vec3> positions = null;
            mesh.SubMeshes[n].VertexData.GetSomeGeometry(ref positions);

            Bounds subMeshBounds = MakeBoundsFromPositions(positions); // <-- you make this function


There is also a shared vertices check in where I looked, you might want to do this first:
Code: Select all   Expand view
VertexData vertexData = subMesh.UseSharedVertices ? subMesh.Parent.SharedVertexData : subMesh.VertexData;


I hope you can carry from this on.

_________________
if(obj as PlayerCharacter is PlayerCharacter)
 
 Profile  

Joined: Sun Jul 03, 2011
Posts: 40
Country: Canada (ca)
PostPosted: Tue Sep 13, 2011 6:04 am 
Bottom of Page Back to top
OK, sounds execiting, I am using the commercial lisence(the one below source code edition), can you please tell me where to look for the example source code? Is it under the MapEditor example ? Thanks again!

 
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  NeoAxis Forum Index » General » General Discussion

Jump to:  

Next topic
Previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


All times are UTC




Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group