Wall Worm Forums

Design Tools => Wall Worm Model Tools => WWMT Questions => Topic started by: Primarina on October 22, 2016, 04:00:37 PM

Title: Help on how to change a model's spawn position
Post by: Primarina on October 22, 2016, 04:00:37 PM
I have been using $upaxis "y" to change the position of the model for some time. While it does work for the most part, I just found out that it doesn't apply to the collision models. As a result, the model always end spawning the sideways not upwards as it suppose to in GMOD

http://image.prntscr.com/image/16f6187ac41a4579bd814d797fe16721.png (http://image.prntscr.com/image/16f6187ac41a4579bd814d797fe16721.png)
http://image.prntscr.com/image/3db74c1cf4764fa889fe9d882bf4def9.png (http://image.prntscr.com/image/3db74c1cf4764fa889fe9d882bf4def9.png)

Oh, and simply rotating and moving the model to the center doesn't work as it will result in the normals/model lighting breaking. I am suspecting it has something to do with the exporter since normals/model lighting looks fine in Max, but in game or HLMV, the normals/model lighting breaks.

In 3DS Max:
http://i.imgur.com/eLUTaG4.png (http://i.imgur.com/eLUTaG4.png)

In HLMV:
http://i.imgur.com/tBdzaqS.png (http://i.imgur.com/tBdzaqS.png)
http://i.imgur.com/MZ3QKjQ.gif (http://i.imgur.com/MZ3QKjQ.gif)

So, does anyone know how to change the way a model is spawned without encounter these issues?
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 23, 2016, 12:58:43 PM
Quote from: Yunpol on October 22, 2016, 04:00:37 PM
So, does anyone know how to change the way a model is spawned without encounter these issues?

Not sure what you mean 100%. It is not clear the entire process. Are you importing QCs first? Importing FBX? Where are the props coming from? Is the hull also being created externally or after imported into Max? But I will give some input.

When a prop is exported with $upaxis Y, the compiler will rotate the model on the X axis so that Y aligns with how the defaults are. I am not certain if this is an entire model rotation or just the root bones (bones with no parent). If it rotates each root bone, it probably means that you need to rotate the collision hull's pivot so that it is aligned to the root bone in the model.

Using an upaxis other than Z is not preferred when working inside 3ds Max. But if importing assets from other sources, you may have to accommodate it. One option (if importing FBX files) is to change the import axis in the FBX importer.
Title: Re: Help on how to change a model's spawn position
Post by: Primarina on October 23, 2016, 01:16:19 PM
Quote from: wallworm on October 23, 2016, 12:58:43 PM
Not sure what you mean 100%. It is not clear the entire process. Are you importing QCs first? Importing FBX? Where are the props coming from? Is the hull also being created externally or after imported into Max? But I will give some input.

When a prop is exported with $upaxis Y, the compiler will rotate the model on the X axis so that Y aligns with how the defaults are. I am not certain if this is an entire model rotation or just the root bones (bones with no parent). If it rotates each root bone, it probably means that you need to rotate the collision hull's pivot so that it is aligned to the root bone in the model.

Using an upaxis other than Z is not preferred when working inside 3ds Max. But if importing assets from other sources, you may have to accommodate it. One option (if importing FBX files) is to change the import axis in the FBX importer.

I guess I need to be more clear then.

I am not importing any qc files or fbx files. I am importing smd files and I created the collision hull inside 3DS Max.
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 23, 2016, 04:09:08 PM
OK, that is probably a good clue.

I think that aligning the hull's pivot to the pivot of the root of your model will help. That includes the orientations (so make the local x/y/z axis of the hull orient to the same directions as the root). You can do that by select the hull, clicking the hierarchy tab in the command panel, choose the affect pivot only, then use the align tool to align it to the root node.

Another possible option is to link the hull as a child to the root node.

Another possible option is to add a skin modifier to the hull and assign the root node as the bone to use.
Title: Re: Help on how to change a model's spawn position
Post by: Primarina on October 23, 2016, 04:57:08 PM
Quote from: wallworm on October 23, 2016, 04:09:08 PM
OK, that is probably a good clue.

I think that aligning the hull's pivot to the pivot of the root of your model will help. That includes the orientations (so make the local x/y/z axis of the hull orient to the same directions as the root). You can do that by select the hull, clicking the hierarchy tab in the command panel, choose the affect pivot only, then use the align tool to align it to the root node.

Another possible option is to link the hull as a child to the root node.

Another possible option is to add a skin modifier to the hull and assign the root node as the bone to use.

FYI, this is how my collision hull looks like. It already has a skin modifier applied to it.

http://i.imgur.com/ryTPXp3.png (http://i.imgur.com/ryTPXp3.png)

A question for you, what do you mean by assigning the root node as the bone to use? Do I assign the root node when I am exporting the collision hull?
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 26, 2016, 12:02:35 AM
Been pretty busy. Send me your original Max file (my email in WW readme). I will discover your conundrum.
Title: Re: Help on how to change a model's spawn position
Post by: Primarina on October 26, 2016, 01:08:52 AM
Quote from: wallworm on October 26, 2016, 12:02:35 AM
Been pretty busy. Send me your original Max file (my email in WW readme). I will discover your conundrum.

Done. I have already sent the email to you.
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 26, 2016, 10:09:07 AM
This was all very straightforward.

Here are the steps I took:


It compiled and is oriented as I'd expect along with the correct hull. Normals in Max and HLMV are identical. But I exported this with Explicit Normals option on... because your model has explicitly assigned normal. If your model has explicit normal, you should turn on explicit normal in the export dialog.
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 26, 2016, 10:17:23 AM
So I misunderstood the file sent... now I see other parts. So looking a moment more now that I understand more of the file.

EDIT: I modified steps above and sent you the scene.
Title: Re: Help on how to change a model's spawn position
Post by: Primarina on October 26, 2016, 01:49:02 PM
Quote from: wallworm on October 26, 2016, 10:09:07 AM
This was all very straightforward.

Here are the steps I took:


  • Opened Scene
  • Rotated Root Bone by 90 degrees so prop facing vertical
  • Opened WWMT Floater
  • Clicked Pick Model and selected Mesh
  • Selected extra mesh pieces and click Add Sel
  • In WWMT turned off all options for the origin settings
  • In WWMT made sure $staticprop was off
  • Selected Hull mesh
  • In hull Rollout, Clicked Add CM Sel
  • In hull Rollout, turned on $concave
  • Clicked Export VTF (made materials but no textures as you didn't send them)
  • Clicked Export QC+Model

It compiled and is oriented as I'd expect along with the correct hull. Normals in Max and HLMV are identical. But I exported this with Explicit Normals option on... because your model has explicitly assigned normal. If your model has explicit normal, you should turn on explicit normal in the export dialog.

I don't know how this is straightforward. I can't seem to replicate your result without the result either being the model's lighting breaks or the collision hull's orientation is wrong.

And FYI, I did export my models using explicit normals though. I have always been doing that for every model I did.

And for the rotating, I did rotated and moved the model to the center in Max initially, but like I said, the model lighting will break if I did that. No idea how you managed to do that without the model lighting getting broken.

Result from rotating and centering the model in Max:
http://i.imgur.com/3aSwUEY.png (http://i.imgur.com/3aSwUEY.png)

Result from using $upaxis "y":
http://i.imgur.com/Exi6S4a.png (http://i.imgur.com/Exi6S4a.png)

Result from exporting your test model:
http://i.imgur.com/so2LuQX.png (http://i.imgur.com/so2LuQX.png)

Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 26, 2016, 02:05:18 PM
So did you get the scene I sent to you? Did you test compiling from that WWMT Helper? You should get correct results. If not, then perhaps update to latest WW.
Title: Re: Help on how to change a model's spawn position
Post by: Primarina on October 26, 2016, 02:44:56 PM
Quote from: wallworm on October 26, 2016, 02:05:18 PM
So did you get the scene I sent to you? Did you test compiling from that WWMT Helper? You should get correct results. If not, then perhaps update to latest WW.

Yea, I did. I even had a picture as evidence in my last post. And I didn't even need to update WW for that.
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 26, 2016, 02:50:16 PM
Sorry... I guess I skimmed some :)

Yeah, all I did was rotate the root node, assign the parts to the WWMT Helper and set the settings (explicit normal, concave, etc) in WW... then export :)

Note that I only rotated the root bone--and nothing else. Maybe that helps.
Title: Re: Help on how to change a model's spawn position
Post by: Primarina on October 26, 2016, 03:00:36 PM
Quote from: wallworm on October 26, 2016, 02:50:16 PM
Sorry... I guess I skimmed some :)

Yeah, all I did was rotate the root node, assign the parts to the WWMT Helper and set the settings (explicit normal, concave, etc) in WW... then export :)

Note that I only rotated the root bone--and nothing else. Maybe that helps.

*facepalm*

All it took to fix was to rotate the root bone...

Wow, I am a very stupid person. I knew this should be simple, but I have overthought about it. As a matter of fact, I could have done this my own, but I didn't realize it.

Well, I learned something new I guess.

Anyways, thanks for helping out regardless.
Title: Re: Help on how to change a model's spawn position
Post by: wallworm on October 26, 2016, 03:07:43 PM
We wouldn't be human if we didn't get a regular diet of facepalms :)