Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

What causes this problem?

Discussion in 'Physics' started by mobidus, May 8, 2016.

  1. mobidus

    mobidus

    Joined:
    Mar 22, 2016
    Posts:
    22
    Hi,


    I've attached an image that shows two problems I cant seem to solve.
    1) when the character walks on top of the platform, the platform slightly moves downwards through another collider.
    2) the character is able to push the platform sideways.
    Both situations should not occur.

    Question is, what's causing this and how can I solve this? (i suppose that's two questions :)) The platform has a rigidbody (required) with a mass 100x larger than that of the character. (btw, The platform is not static as the image suggests, the collider below it is). I've attached a physics material to the platform where friction =1 and bounciness=0.

    I'm using version 5.3.4

    Any help would be appreciated
     
    Last edited: May 8, 2016
  2. mobidus

    mobidus

    Joined:
    Mar 22, 2016
    Posts:
    22
    I think I found whats causing this. It's actually a bit silly as I should have realized this earlier, but because I have my own physics on this character, what I think is happening is that the platform is trying to evaluate for the character's collider as well as for the floor. It's sort of squeezed into it's correct position again.
     
  3. HiddenMonk

    HiddenMonk

    Joined:
    Dec 19, 2014
    Posts:
    987
    Just set the platform to kinematic if it isnt meant to move.
    If it is meant to move, then your custom character physics Im assuming is not using any physics methods like addforce or moveposition? If so, then the mass of the platform is probably irrelevant since if your character physics isnt perfect and ends up inside the platform, the platform will try to break free.
     
  4. mobidus

    mobidus

    Joined:
    Mar 22, 2016
    Posts:
    22
    Thanks for the reply. Your assumptions are correct. I cannot use kinematic mode unfortunately (seems like the easy way out, too) so I'll try and see if I can improve my physics (raycasting) calculations for this character.
     
  5. HiddenMonk

    HiddenMonk

    Joined:
    Dec 19, 2014
    Posts:
    987
    Would freezing the platforms rigidbody rotation and position work (found on the rigidbody component), or by you not being able to use kinematic do you mean that the platform is meant to be moving?
     
  6. mobidus

    mobidus

    Joined:
    Mar 22, 2016
    Posts:
    22
    That is not an option, as it's possible for the platform to spawn mid-air and so it should be able to fall on top of other objects.