Home Unity

Unity - House Collision Issues

Novian
polycounter lvl 12
Offline / Send Message
Novian polycounter lvl 12
Greetings all,

I am having an issue with Unity Collision meshes that I am hoping you can help me with. Before you ask, yes

I searched the Unity forums and there is at least one person having a similar but not quite the same issue and it

has not been solved:

http://forum.unity3d.com/threads/138584-Collision-Help

I am creating a game in which the player explores a house as the main hub and then each level consists of a

subset of rooms, therefore the rooms are built as modular pieces that seamlessly connect together.

The issue comes into play with the collision mesh for the rooms. When traveling from room to room, or even

sometimes between doorways that are part of the same room (model) the player gets slowed or even stuck completely.

You can see the issue represented in the following two videos:

[ame="http://www.youtube.com/watch?v=nLrwgdR9-iI&feature=BFa&list=PL22023755D1F64739"]http://www.youtube.com/watch?v=nLrwgdR9-iI&feature=BFa&list=PL22023755D1F64739[/ame]

From 00:10 - 00:20 you can see the player is slowed but not stopped when attemping to go from the Master

Bedroom into the MB_Closet. The MB_Closet is a seperate piece as mentioned above.

From 00:20 - 00:30 you can see the player is completely blocked when attempting to go from the Master Bedroom

into the Master Bath area.

[ame="http://www.youtube.com/watch?v=q1kyduEMCmY"]http://www.youtube.com/watch?v=q1kyduEMCmY[/ame]

In video 2 we begin in the Master Bathroom.

From 00:04-00:06 the player is blocked from entering the WC even though it's doorway is the same width as the

Master Bedroom closet and is part of the same piece.

From 00:07 - 00:11 we see the desired behaviour for all doorways and room "seams".

From 00:12 - 00:20 we see the player is able to walk into the Master Bathroom Walk in closet with the slowed

effect however once in the room the player is blocked from leaving the room.

Any suggestions or information you guys could provide would be most appreciated.


Cheers~

Replies

  • gsokol
    Offline / Send Message
    gsokol polycounter lvl 14
    Your slowing down because your fighting collision.

    Have you modified the collision of the first person controller at all? By default its the same size as the pill. It looks like the doorways are too narrow, so your getting hung up. The doors seem to be a little too small in my opinion. The other option is to reduce the size of the collision on the first person controller.
  • Novian
    Offline / Send Message
    Novian polycounter lvl 12
    gsokol,

    Thanks for your input. You are correct that the doorways look small. They are Real World Scale but I have indeed shortened the Player's collision size. The slowing down due to fighting collision, could you elaborate on exactly what that means and how best to correct it?

    The slowing down makes sense however the complete obstruction from within the same modular chunk does not.

    Cheers~
  • gsokol
    Offline / Send Message
    gsokol polycounter lvl 14
    Ahh ok I see whats going on. How are you getting your collision? Just generating colliders from the imported geo? Or do you have your own collision mesh?

    Maybe your geometry is bad. Make sure to delete transforms and whatnot. Make sure there are no stray floating verts or anything like that.

    Thats the first things that come to mind.
  • Novian
    Offline / Send Message
    Novian polycounter lvl 12
    gsokol,

    The collision originally came from each part's own geo. I saw the issue and asked around. I was told to make a separate mesh would be used just for collision. So I took a copy of each room, attached them all together and imported that as a mesh. I then assigned that mesh to the collision mesh of each individual room part. Still I get the same result.

    I will double check about the stray verts and such but I am pretty sure I accounted for that. I did a weld 0 as well as a reset x form before exporting.

    As soon as I can get back to my desk I will create a diagram for how I have the scene set up, perhaps that will help.

    Just in case, how does one go about deleting the transforms in Max? I will try that as well.

    Thanks very much for all your help!

    Cheers~
  • rooster
    Offline / Send Message
    rooster mod
    just going from the vid it does look like the player collider is too tall or wide. Have you tried going into the edit camera and looking closely at the player size compared to the gap?

    the first thing I do in these situations is go extreme and remove all doubt about the problem- either scale the house by 2(or more) or half your player collision size and see if you can fit through.

    just using the visial geometry for your collision isn't the optimal way, but it should still work

    If you're still blocked after that test and suspect it's geometry, always try re-importing your exported model into your 3d package, to see what it is the engine is actually dealing with. If it comes back in borked, chances are your export is at fault (although keep an open mind the import back may also bork it, it's good to try importing into more than one 3d package as a test if possible). Having said that, if the render model and collision are the same, then you should see any problems.
  • Novian
    Offline / Send Message
    Novian polycounter lvl 12
    rooster,

    Thanks! I shall try that as well and report back.

    Cheers all~
  • Novian
    Offline / Send Message
    Novian polycounter lvl 12
    Gents,

    Turns out it was my character controller collision was too "fat". I got it working by taking your suggestion rooster, and making the character literally stick-figure thin and now I am working my way up trying to find the settings that "feel right". Many thanks to you both for all your help. I do have one final question that is related.

    I believe the scale of the room parts may have also played a part so if it's alright I'll segway into the age old question of "what is the magic sequence to export from max into unity" with that ever sought after 1:1 ratio. The caveat to this is, I am modeling the house in inches in max and idealy I'd like to be able to export directly to unity and go from there.

    I have found the following resources that describe the process but my question is, these speak about translating 1:1 with meters. Is there any difference when going from Max inches to unity? Or do I have to do some math (i.e 1 inch = .0254 meters) etc..

    Thanks again for all your help on the collision and any input you might have on the scale/export question as well.

    Cheers~

    References: http://forum.unity3d.com/threads/115047-Max-2012-Scale-Test-Issues
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 17
    Unity's scale is 1 grid unit = 1 meter. As long as you're using physics, you should attempt to keep to that scale. If your Max scene is set up as 1 unit = 1 inch, then yeah, you'll want to set up your max exporter to export at 0.0254 scale for a hassle-free workflow.
  • Novian
    Offline / Send Message
    Novian polycounter lvl 12
    LoTekK,

    Thanks for the info! It's great to know that I am on the right track. One question for you (and granted I don't have Max in front of me to look) where in the export as fbx dialog can I set Max to export at .0254? I am using Max 9 by the way.

    If you can answer that I'd appreciate it. I won't be home till late tonight but then I'll be right back on this project. Very excited to be past these issues!

    Thanks again all.

    Cheers~
Sign In or Register to comment.