This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [TOOL] [M2 edit] Collision Adder  (Read 13510 times)

Eluo

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 509
    • View Profile
[TOOL] [M2 edit] Collision Adder
« on: August 22, 2011, 03:02:08 am »
[center:3it2u7ty]Collision Adder by Tigurius[/center:3it2u7ty][/b][/u]

About this tool:.
Copys the full verts of the m2 model as collision into the model.

Additional Info:
Used in 3.x
Source Included

Download:
[attachment=0:3it2u7ty]CollisionAdder.rar[/attachment:3it2u7ty]


External:

File-upload.net
Mediafire.com
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
One is a genius, the other\'s insane!

Mjollna

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 254
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #1 on: October 26, 2011, 01:30:49 am »
Hello !

Ok, so here's how I added collisions to my model (the road I posted earlier).
When I started to look at collisions, I tried to use Collision Adder, but it didn't seem to work exactly the way I expected.
That's why I decided to have a look at the source (thank you so much for including it) and try to understand how it works.

After some time, I thought it was related to the way normals were handled. As I understand it, the program copies the model vertice and normals, as well as the skin file triangles, to make a custom bounding box.
The wiki (and that's also what I observed on a Blizz model) says there's one surface normal per triangle for the bounding box, and not 3 like the ones that go with the model vertice.
So I slightly edited the program to make it fit : one normal per triangle (so their number was divided by 3), and I added cross product + normalize to calculate the values for each of them using the existing functions.

Of course I include the modified main.cpp as well as the exe.

Be indulgent, C++ (and M2 actually) is like a whole new world to me. It took me time to figure out how to compile the original program, adding my 4 lines at the right place, etc.
Nonetheless, it looks like my changes work here (and I'm the first one surprised they do), so I post them. Hope it'll be useful.

I tested the program on 2 models only, since I don't have many of them. Of course, on both it worked.

Feedback is welcome :)

Direct download: http://d.pr/8PGT+
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Zim4ik

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 407
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #2 on: October 26, 2011, 10:04:09 am »
Hi,
Could you post a link to download, cause i "dont have a permission to download files".
Thanks
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #3 on: October 26, 2011, 10:11:07 am »
Quote from: "Zim4ik"
Hi,
Could you post a link to download, cause i "dont have a permission to download files".
Thanks
Added to first post.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

TheBuG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 469
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #4 on: October 26, 2011, 02:07:07 pm »
Quote from: "Mjollna"
Hello !

Ok, so here's how I added collisions to my model (the road I posted earlier).
When I started to look at collisions, I tried to use Collision Adder, but it didn't seem to work exactly the way I expected.
That's why I decided to have a look at the source (thank you so much for including it) and try to understand how it works.

After some time, I thought it was related to the way normals were handled. As I understand it, the program copies the model vertice and normals, as well as the skin file triangles, to make a custom bounding box.
The wiki (and that's also what I observed on a Blizz model) says there's one surface normal per triangle for the bounding box, and not 3 like the ones that go with the model vertice.
So I slightly edited the program to make it fit : one normal per triangle (so their number was divided by 3), and I added cross product + normalize to calculate the values for each of them using the existing functions.

Of course I include the modified main.cpp as well as the exe.

Be indulgent, C++ (and M2 actually) is like a whole new world to me. It took me time to figure out how to compile the original program, adding my 4 lines at the right place, etc.
Nonetheless, it looks like my changes work here (and I'm the first one surprised they do), so I post them. Hope it'll be useful.

I tested the program on 2 models only, since I don't have many of them. Of course, on both it worked.

Feedback is welcome :)

Direct download: http://d.pr/8PGT+

I'll give it a try when I've got some 3d modelling programs installed again, thanks!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vel

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 340
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #5 on: October 26, 2011, 06:34:54 pm »
wow, checked on my 24 models . 100% fine work
-----
THANK YOU!  :!:
Zim4ik wrote to me on Skype about this tool:

Original:
[21:31:57] Богдан | Zim | Билитюк: Скажи ей/ему спасибо
-
Translate:
[21:31:57] Bogdan | Zim | Bilityuk: Tell her thank you very much
« Last Edit: October 26, 2011, 06:49:12 pm by Admin »
is no more

Mjollna

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 254
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #6 on: October 26, 2011, 06:47:13 pm »
Oooh great ! :)

Thanks for testing, and I'm so happy it also works on other models than mine ^_^
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vel

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 340
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #7 on: October 26, 2011, 07:20:02 pm »
On one of the models not added collision

As should be:
C:Documents and SettingsUser>D:tempCollisioncollisionadderCollisionAdder.e
xe D:tempCollisioncollisionadderEnclaveWallfragment01.m2
Loading Model D:tempCollisioncollisionadderEnclaveWallfragment01.m2
 Loading Skin D:tempCollisioncollisionadderEnclaveWallfragment0100.skin

Saving Changes

As happens with bugged? model:
C:Documents and SettingsUser>D:tempCollisioncollisionadderCollisionAdder.e
xe D:tempCollisioncollisionadderEnclaveWallpost.m2
Loading Model D:tempCollisioncollisionadderEnclaveWallpost.m2
 Loading Skin D:tempCollisioncollisionadderEnclaveWallpost00.skin


-
Missing line "Saving Changes".
collision in model also not added.
(The model I have added below)

this my 31th model (of 100-120)

I can give you more models that do not work in Collision adder (via Private Message)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
is no more

Mjollna

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 254
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #8 on: October 26, 2011, 09:35:09 pm »
Mmh, could you send me your mdx for this model ? It would be really easier for me to see if there's something different from the one I use, and why one of them works and not the other.

Are there lots of models that don't work for you ?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vel

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 340
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #9 on: October 26, 2011, 09:42:43 pm »
does not work about 20-40% models.
oh mdx... i have only mdl((MDX analog, which can be edited via Notepad) source. now take a search.
up1:  Attach two MDL models in the archive
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
is no more

Mjollna

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 254
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #10 on: October 26, 2011, 10:33:44 pm »
Thanks, that was really helpful :)

I don't get why for the moment, but I have a simple fix :

If number of vertice < number of faces in mdl/mdx (you have both numbers in mdlvis in the upper right corner of the vertice editing mode), the conversion crashes.

So you can take the model, copy a free vertice (on both models you have one in more or less the center of the grid), and paste it until you have more vertice than triangles. The the converter doesn't complain and it goes ok.

I'll try to see if I can correct that better.

(And btw, I really like the shape of the fence you sent ^^)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vel

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 340
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #11 on: October 26, 2011, 11:45:58 pm »
hmm, when converter was crashes. I copied (duplicate) geometry in model, while number of triangles was still several times more (than vertices). But a model successfully converted. (Similar problems were encountered only in models with 2-3k triangles)

or something I do not fully understand.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
is no more

Mjollna

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 254
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #12 on: October 27, 2011, 05:40:38 pm »
I tried to solve the problem yesterday night but I still haven't a clean solution to correct it. I will try again though, when I have a new idea.

Do you still have some models you can't convert at all, even with the "add more vertice" trick ?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #13 on: October 27, 2011, 06:00:18 pm »
Quote from: "Vel"
As happens with bugged? model:
C:Documents and SettingsUser>D:tempCollisioncollisionadderCollisionAdder.e
xe D:tempCollisioncollisionadderEnclaveWallpost.m2
Loading Model D:tempCollisioncollisionadderEnclaveWallpost.m2
 Loading Skin D:tempCollisioncollisionadderEnclaveWallpost00.skin


Code: [Select]
$ ./CollissionAdder ../wtfmodel/EnclaveWallpost.m2
 Loading Model ../wtfmodel/EnclaveWallpost.m2
 Loading Skin ../wtfmodel/EnclaveWallpost00.skin
Saving Changes

I see no problem there.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Mjollna

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 254
    • View Profile
Re: [TOOL] [M2 edit] Collision Adder
« Reply #14 on: October 27, 2011, 06:17:58 pm »
O_o

That one is weird... On Vel's model I have a converter crash with my modified version (but not with the original one : the collisions are then saved but not correctly created).

There's definitely something I don't get :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »