Search Unity

Rigidbody Capsule, rotate it or not?

Discussion in 'Physics' started by Armetron, Sep 4, 2018.

  1. Armetron

    Armetron

    Joined:
    Oct 7, 2016
    Posts:
    12
    Hi just a quick question, when making a character with a rigidbody instead of a character controller what is the best practice in regard to the collider that goes around the "player".

    should it move with only the internal stuff rotating to prevent more collision calculations. or does it not matter and its ok to rotate the entire thing.

    both cases work I just want to be efficient
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,096
    The question doesn't make sense.
     
  3. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    793
    Define "internal stuff" versus "the entire thing" please.
     
  4. Armetron

    Armetron

    Joined:
    Oct 7, 2016
    Posts:
    12
    Sorry, What I mean is in code when you set transform.rotation you essentially rotate the entire GameObject, however you could have individual components be rotated internally, A camera for example can point in the new "forward" but not have to rotate the Collider. You can have the player model rotated to make it look like its facing a different direction without having to rotate the GameObject

    What I wanted to know mainly is, does rotating the Capsule Collider on the y axis cause any unnecessary collistions? and if it does how impactful on performance is it?
     
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    736
    A gameobject has a transform, and maybe a rigidbody and maybe some colliders. If the transform changes, all the colliders change to match without extra work and it would be extra work to avoid it.

    If you're asking about performance of a capsule collider rotating around its long axis, there is no mathematical reason it would behave differently at any rotation on that axis. Let the engine do what's natural.

    Google "premature optimization."
     
unityunity