Unity Community


Page 1 of 2 12 LastLast
Results 1 to 20 of 21

  1. Posts
    27

    first person controller falls through the terrain

    i do not know what happened i am making my game and my city all is well, and now i am detailing and editing, i did no changes to the first person controller, but now no matter what i do and where i put him he just falls, i have re-imported, deleted, and did all i could and he just falls, i even reset. i opened an old project and it still works there but i can see no differences in the settings that makes him fall through, did i do something irreparably wrong or is there something i can do to fix this problem?


  2. Posts
    886
    What if you put the controller about a foot above the terrain when you start? Will he still fall through?


  3. Posts
    27
    yea i have tried him in all different locations of the city where once everything worked perfectly, it is something that just started today, i did no changes to anything just general moving and scaling of buildings

  4. VL3 VL3 is offline

    Posts
    43
    Did you attach colliders?


  5. Posts
    126
    If colliders are attached to all objects, could you have turned one of the colliders into a trigger by mistake?


  6. Location
    Austin, TX
    Posts
    751
    Also, for random errors, if you use transform.position to move your character around, it will move through the terrain.
    if (Unity) happiness++;


  7. Posts
    27
    basically what i have is this, generate terrain thn i set resolution to my desired size, afterward i set all my prefabs in with generate colliders everything worked perfectly..... until yesterday i see nothing that could have changed, i cannot put the character controller anywhere he just falls i think it is a glitch or something just thought maybe there is a way to do a generall reset to default of the characters without potentially loosing all my hard work, i will see about cutting and pasting all the files to a new project to see if that rectifies the situations.


  8. Posts
    15
    Well this isn't just a random by chance problem. I was teaching a class of 28 students today and we all ran into this problem!? No matter how many times we recreated the first person controller it fell right through the terrain. We tried deleting it out and recreating the controller and every once in a while if we were lucky it would work the way it should.

    There must be a predictable logical reason why this happens and hence a solution.

    Anyone know of how to fix this problem?


  9. Posts
    445
    artby, falling through the floor is something that happens more frequently when you're new to Unity, atmadaenygma's case perhaps being an exception. In the case of you and your students, the most likely situation is you guys chose poor y-coordinates for the player's starting position--ie, his feet might have begun slightly beneath the ground plain. That's hard to detect without a good camera angle, and that's why WinningGuy was suggesting started a few feet above the floor to be on the safe side.

    Also consider the other possibilities discussed in this thread.

    To debug, drop the player and a cube from high up and see if they go through the floor. If they do, you know to investigate the floor's properties. If only the player does, you investigate the player's properties.
    Last edited by Ostagar; 10-13-2010 at 02:55 AM.


  10. Location
    USA, Wendell
    Posts
    5

    post

    I'd like to talk this topic personally with Atma. Contact me please.

  11. RHD RHD is offline

    Location
    London, UK
    Posts
    608
    I just imported a project from Unity 2.6 to Unity 3 and now my FPC drops through terrain. All the colliders on the terrain seem to have stopped working. This happens also on the models but those I could add colliders to or re-import. The terrain I do not know how to fix.
    Unity Pro - Mac


  12. Posts
    1

    Better Late Than Never

    Hi All,

    Just in case people are searching for an answer to this, like I was, I had a similar problem. It turns out I set the XYZ of the Main Camera attached to the First Person Controller -- and not the First Person Controller. Make sure that the Main Camera attached to the First Person Controller XYZ is set to 0,0,0 (or something appropriate). Then, set the XYZ of the First Person Controller.

    ~ Scott

  13. RHD RHD is offline

    Location
    London, UK
    Posts
    608
    Thanks for your post. My problem turned out to be slightly different.

    I know of old that if you have the green wireframe set through the floor the FPC will drop through.

    What happened to me when I upgraded my project to 3 was that even though the important green wireframe was slightly above the terrain, the gray capsule (sorry, too tired to look up the correct terminology right now) which was switched off as I didn't want it, was sticking out below the terrain. This hadn't mattered in Unity 2.6 but apparently did in 3. And as it was switched off it took me a very long time to take an interest in it and by trial and error, figure it out.

    It's always the simple things....except when it's the really complicated ones!

    .
    Unity Pro - Mac


  14. Location
    Kerbal Space Program Forums
    Posts
    175
    I am having the same problem, and I have all of these things in order (i.e. moving the whole FPC, the capsule is above the terrain, etc.) but it still falls through the terrain. I have even tried making my own FPC, but that still falls through. My only guess is that the Terrain Collider is screwed up by using the terrain toolkit asset package to make the terrain.

    Can anyone help confirm this?


  15. Location
    Reykjavķk, Iceland
    Posts
    25
    I made cube and made it flat, i put character alot over the "floor", puted the charactercontroller to the character, and my MoveAround script:

    //Moving around
    var speed =3.0;
    var rotateSpeed = 3.0;
    //shooting
    var bullitPrefab:Transform;
    //dying
    static var dead = false;
    //Getting hit
    var tumblespeed = 800;
    var decreseTime = 0.01;
    var decayTime = 0.01;
    static var gothit = false;
    private var backup = [tumblespeed, decreseTime, decayTime];

    function LateUpdate()
    {
    if(dead)
    {
    transform.position = Vector3(0, 0, 0);
    gameObject.Find("Main Camera").transform.position = Vector3(0, 0, -10);
    dead = false;
    }
    if(gothit)
    {
    if(tumblespeed < 1)
    {
    //We“re not hit anymore... reset & get back in the game!
    tumblespeed = backup[0];
    decreseTime = backup[1];
    decayTime = backup[2];
    gothit = false;
    }
    else
    {
    //We“re hit! Spin our character around
    transform.Rotate(0,tumblespeed * Time. deltaTime,0, Space.World);
    tumblespeed = tumblespeed-decreseTime;
    decreseTime += decayTime;
    }
    }
    }

    function OnTriggerEnter(hit : Collider)
    {
    if(hit.gameObject.tag == "fallout")
    {
    dead = true;
    //substract life here
    HealthControl.LIVES -=1;
    }

    if(hit.gameObject.tag == "enemyProjectile")
    {
    gothit = true;
    HealthControl.HITS += 1;
    Destroy(hit.gameObject);
    }
    }
    function Update ()
    {
    var controller : CharacterController = GetComponent(CharacterController);

    // Rotate around y - axis
    transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);

    // Move forward / backward
    var forward = transform.TransformDirection(Vector3.forward);
    var curSpeed = speed * Input.GetAxis ("Vertical");
    controller.SimpleMove(forward * curSpeed);

    if(Input.GetButtonDown("Jump"))
    {
    var bullit = Instantiate(bullitPrefab,
    transform.Find("Spawnpoint").transform.position,
    Quaternion.identity);
    bullit.tag = "wormProjectile";
    bullit.rigidbody.AddForce(transform.forward * 2000);
    }
    }

    @script RequireComponent(CharacterController)

    My character falls through the cube, and the same happens if i chanche the cube into terrain. HELP!!!!!!!!!!!!!!!!


  16. Location
    Kerbal Space Program Forums
    Posts
    175
    Alright I think I figured this problem out. I dragged the "UH-1N" prefab into the Bootcamp demo level, attached a mesh collider and rigidbody. It still fell. I then looked at the rest of the rigidbody-equipped objects in the level and they had the "Kinematic" box on the rigidbody checked. I checked that box on the UH-1N and it didn't fall through! So apparently you need to check the "Kinematic" box in order for it to actually collide, and make the collision detection "continuous dynamic."

    OrbitusII
    Last edited by OrbitusII; 10-22-2011 at 07:13 AM. Reason: The kinematic box is on the rigidbody, not the colliders


  17. Location
    Kerbal Space Program Forums
    Posts
    175
    Also, it is completely essential that you use the layers as they are used in the bootcamp demo, else the colliders will not work. E.G. the terrain needs to be the "terrain" layer, your 1st person controller prefab needs to be the "player" layer, etc. For level objects (like buildings, etc) they need to be the "hit" or "hit 2" layer. This is the solution to this problem. You may need to go into the "project settings>physics manager" and check or un-check certain boxes if you want certain layers to collide or not to collide with other layers, but this step is a last resort in case the layering correction still fails (which it won't, so the only real time you need to change the physics manager settings is when starting a new project).

    This is my final answer, and I have indeed tested this with successful results. Any other possible solutions are unknown to me, so please don't ask.

    OrbitusII
    Last edited by OrbitusII; 10-24-2011 at 03:17 PM. Reason: the colliders actually will work if you mess around a ton, but you have to mess around in the right places :3


  18. Posts
    1

    first person controller falls through the terrain

    t may be bit late to see another answer for this. However, I simulated this issue bu just creating a terrain, Firstperson Controller and Directional Light. In terrain I just initially checked isTrigger attribute. This time the fpc, was falling through the terrain. So I uncheked the attribute and found it is working as expected. May this solution will help somebody who is facing this issue. I am using Unity 3.5 to do this.



    Quote Originally Posted by OrbitusII View Post
    Also, it is completely essential that you use the layers as they are used in the bootcamp demo, else the colliders will not work. E.G. the terrain needs to be the "terrain" layer, your 1st person controller prefab needs to be the "player" layer, etc. For level objects (like buildings, etc) they need to be the "hit" or "hit 2" layer. This is the solution to this problem. You may need to go into the "project settings>physics manager" and check or un-check certain boxes if you want certain layers to collide or not to collide with other layers, but this step is a last resort in case the layering correction still fails (which it won't, so the only real time you need to change the physics manager settings is when starting a new project).

    This is my final answer, and I have indeed tested this with successful results. Any other possible solutions are unknown to me, so please don't ask.

    OrbitusII


  19. Posts
    1
    I solved the problem. I applied a rigidbody compoment on my cube(which is also my terrain) and I just removed it .

    Et voilą Rather easy na?


  20. Posts
    2
    Quote Originally Posted by RHD View Post
    Thanks for your post. My problem turned out to be slightly different.

    I know of old that if you have the green wireframe set through the floor the FPC will drop through.

    What happened to me when I upgraded my project to 3 was that even though the important green wireframe was slightly above the terrain, the gray capsule (sorry, too tired to look up the correct terminology right now) which was switched off as I didn't want it, was sticking out below the terrain. This hadn't mattered in Unity 2.6 but apparently did in 3. And as it was switched off it took me a very long time to take an interest in it and by trial and error, figure it out.

    It's always the simple things....except when it's the really complicated ones!

    .
    Yes and anybody in the future have this problem... I would just like to add that raising the plane or terrain, and the First Person Controller will most likely solve the issue.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •