Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Please help me in Unity problems

Discussion in 'Scripting' started by Bioshok2, May 9, 2014.

  1. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hello Everyone,

    I encountered several problems on Unity c #, I need your assistance please, thank you:

    1 I would use a dual shok 3 Unity, I could access and use the code with all the buttons on the controller (also including the directional pad), from the fact
    I do not know how to access and use both analog sticks("thumbsticks ps3 ") , please code needed to control and use both analog sticks thank you. I would

    2 I have a water surface but the problem, although I increased to infinity the surface there, there is no depth to the surface, it's just a flat surface

    3-when I use gravity on the player, it passes through the platform below him despite the use of rigid body, and the collider mesh method (empty) OnCollisionEnter on the player and platforms.
    How to solve this problem.

    Thank you and good day.

    soon.
     
    Last edited: May 9, 2014
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    At least one of the mesh colliders has to be set a concave, otherwise no collision will take place.
     
  3. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hi Dantus,

    I enabled convex for the player but there's always the same problem.

    Thank you and good day.
     
    Last edited: May 9, 2014
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    It should certainly be convex and not concave. Check the docs, both have to be convex.
    http://docs.unity3d.com/Documentation/Components/class-MeshCollider.html

    Edit: You should consider to use other kinds of colliders, at least for the character. This is a lot faster and the collision response is also more reliable.
     
  5. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Welcome back,
    Unfortunately for the collision, it still does not work:
    I tried both convex set, I also changed later in the collider colliders box and sphere collider and still the same problem.
    In fact the platforms do not appear on stage only in rendering game because I use the function to instantiate it.
    May be that the problem comes from.
    Otherwise what are the roles of istrigger variables, material, convex, smooth sphere collider and mesh of meshcollider
    (may be that the problem comes from too).
    Thank you and good day.
    Cordially.
     
  6. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Please show a screenshot of the settings for those colliders and rigidbodies.

    You have almost all the explanations in the documentation.
     
  7. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hi Dantus ,
    Here are the images attachments.
    Thank you .
     

    Attached Files:

    Last edited: May 9, 2014
  8. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    What kind of scripts did you attach to those objects? Does the collision work correctly if you deactivate those scripts?
     
  9. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Welcome back ,
    one only script for player (displacement)
    and one only script too for platforms (instantiation and mouvement )
    thank you again
     
  10. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    And does the collision work if you deactivate those scripts?!
     
  11. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hello Dantus,

    I can not disable script platforms because with it , that I instantiates .platforms .

    I will try with the player's movement and I will keep you informed tomorrow.

    But may be the problem is because of the public variables of a mesh collider components and rigid body kinematic ex is, material or mesh the mesh collider or missing in the source code of the collision, stp what do you think? Thank you and good day. Cordially.
     
    Last edited: May 9, 2014
  12. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    A mesh collider with no mesh assigned to it will do nothing. (Your first image)
     
  13. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Holy... How could I miss that? You are certainly right.
     
  14. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hello everyone,

    Thank you Dantus and KelsoMRK.

    The problem is not always solved. I put the platforms (name "GameObject") and player (name "Inconnu") in convex meshes with mesh colliders for their both,

    I just changed the configuration of the mesh colliders too (see pictures attached)

    But the player always passes through the platform below it.

    As there is no collision detection with the debug.log OnCollisionEnter, stay and Exit. Also,

    There are error message on the console: "the Hull Has more than 255 polygons this is invalid."

    the create platforms by to instantiate, do not appear on the scene, but only in the game made, may be because of that, what do you think please? Thank you and good day. see you soon.
     

    Attached Files:

  15. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You got an error message, get rid of it.
     
  16. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hello Dantus,

    I changed the mesh collider by sphere collider for player and box collider for Cubic Platforms.

    I have not been able sphere and box collider in convex and mesh because it have no options in components for that .

    error messages disappeared in this case, but the collision problem is still not resolved, moreover still no collision detection with debug.log OnCollisionEnter, Stay and exit.

    Is that it may be a connection with the fact that Platforms do not actually exist on the scene only instantiated with the instantiate method.
    Thank you and good day.
     
  17. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    No, it doesn't matter that the platform is instantiated. What matters on the other hand is how the platform is setup and how you move it.
     
  18. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hi ,

    i instantiate these platforms , after i affect these platforms for many arrays .
    I move platforms (by aray ) with translate or rotate or variation of localscale .

    may be by modifying the mesh colliders, by simple box and sphere colliders,
    I didn correctly configured, them

    .(I have not found the mesh and convex in the options box and sphere collider)
     
  19. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The issue for me right now is that you have your project and there may be a bunch of things that influence the collision. What you have to do is to isolate the issues. E.g. OnCollisionEnter is not called, let's create a new scene, bring the basic functionality up, does it now work? If no, break it down even further until it works. As soon as it works, check what the differences are to understand what went wrong in the other scene.
    If you have trouble to find the causes in the isolated scene, please ask again. But right now there seem to be many influences.
     
  20. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    alright, you're right, I think too this is the best solution.

    I would try to isolate and break down the project as you advised me,
    and I would keep you informed.

    Thank you and good afternoon.

    see you soon.
     
    Last edited: May 11, 2014
  21. Bioshok2

    Bioshok2

    Joined:
    Apr 14, 2014
    Posts:
    60
    Hello Dantus and Hello every one ,

    I found the problem of collision,:


    the collision works very well for the first element (0,0,0) mean the first platform but not for other platforms.

    mean as if the variables and options components inspector walked only instantiated the first platform (the original) and not for others.


    the problem is solved with use add component "meshcollider" for all platforms

    thank you very much and good day.

    see you soon