## finding centre point of a summash

Users browsing this forum: No registered users and 1 guest

Next topic
Previous topic
 NeoAxis Forum Index » General » General Discussion Search for:
Author Message

Joined: Sun Jul 03, 2011
Posts: 40
 Posted: Mon Sep 12, 2011 3:51 am Post subject: finding centre point of a summash
 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!

Joined: Tue Sep 16, 2008
Posts: 1341
Location: Imatra
 Posted: Mon Sep 12, 2011 3:19 pm
 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.

Joined: Sun Jul 03, 2011
Posts: 40
 Posted: Tue Sep 13, 2011 5:18 am
 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!

Joined: Tue Sep 16, 2008
Posts: 1341
Location: Imatra
 Posted: Tue Sep 13, 2011 5:50 am
 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 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.

Joined: Sun Jul 03, 2011
Posts: 40
 Posted: Tue Sep 13, 2011 6:04 am
 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!

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending

 Jump to:  Select a forum ------------------ General    News    Help    Help - Programming    Bugs    Feature Requests    General Discussion Additional    Showcase    Community Projects, Add-ons & Code Samples    Tutorials and Articles from Community    Projects    Artists & Content Creators    Recruitment    Website Feedback    Lounge / Off-topic

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