Search Unity

How do you guys deal with weapons / items that have different positions?

Discussion in 'Game Design' started by Maximilious, Feb 13, 2018.

  1. Maximilious

    Maximilious

    Joined:
    Nov 29, 2016
    Posts:
    28
    For example.

    Say I purchase a new weapon pack asset from the store, I put them to my item system where I have LeftEquipSlot, RightEquipSlot, LeftBackEquipSlot, etc... these are attached to the player model from the class I created in runtime.

    All the weapon prefabs from the asset store I purchased in the first instance works, awesome!

    Then I buy another weapon pack from another creator, but this time my weapons are all over the place, or rather they all follow the same pattern of being Y rotated 90 or 180 degrees, etc...

    I mean, I can probably hardcode an offset for weapons that do not match the same prefab as the ones I built it from, but there has to be an easier way of dealing with multiple prefabs from multiple creators for weapons.

    Thanks in advance
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Just fix them. That is, drag one of your new weapons into the scene, do "Break Prefab Instance" on it, position and rotate it to the way you want your weapons positioned and rotated, and then make a prefab out of it.

    There's absolutely no rule that says you have to use the prefabs that come with the pack, exactly as they are.
     
    Ryiah and theANMATOR2b like this.
  3. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    I am not sure this solution would be any faster than what @JoeStrout said, but for me I think it would be.

    I'd import all of the trouble models into my 3d app -- maya in this case -- select them all, set absolute transform to 0,0,0. If they need rotated, that is quick and easy to. Then, freeze transformations, and export. When they come into Unity, they will be at the origin, and you can have them facing the z direction or whatever you chose.

    That would be the fastest way I can think of.

    Side note: I recently submitted my first model package to the Unity store, and among many quality control restrictions, one of the things they require is that your asset be centered at the origin.

    Are you buying these from Unity asset store?
     
  4. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    only putting the weapons to 0,0,0 will not be enough, since all weapons have different size.

    what I did in my WeaponPickup system that I put a transform under the right hand, gave them the weapon's name and positioned and rotated it so they are placed right.
    and then only when picking the weapon up, they just need to be parented under that transform.