Search Unity

Character controller or rigidbody?

Discussion in 'Editor & General Support' started by Spacemonkey, Apr 25, 2009.

  1. Spacemonkey

    Spacemonkey

    Joined:
    Oct 24, 2008
    Posts:
    89
    After reading this thread:

    http://forum.unity3d.com/viewtopic.php?t=23249

    ..I got a little spooked. I'm planning to have quite a few characters running around at once in my project and was set on just slapping a character controller onto each of them. But maybe rigidbodies would be better? From reading the docs they seem easy enough to use but is there any catch to using them instead of character controllers for pc/npc entities?
     
  2. CoatlGames

    CoatlGames

    Joined:
    Apr 25, 2008
    Posts:
    773
    im currently using a rigid body character controller.. its fairly easy to make and works great, now you can make the player interact with other rigid bodies..

    and as your character controller is just one more rigid body its no problem at all with the performance

    i managed to get 22-24 frames with 1200 rigidbody cubes and smashing a jeep into them and still be fairly fluid on my laptop with a geforce 9600

    so i guess some characters would not hurt too much
     
  3. Spacemonkey

    Spacemonkey

    Joined:
    Oct 24, 2008
    Posts:
    89
    Thanks alot :) Guess I'll ditch the Character Controller for now and have myself a proper sniff at rigidbodies then.
     
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,837
    The character controller is plenty fast, rumors otherwise are not really based on facts as far as i can see.

    The real reason for using a rigidbody is if you want the character to be pushed by rigidbodies or other more integrated physics interaction without writing custom game code. In some cases, writing custom game code for pushing rigidbodies is a good thing, in some cases it isn't. Depends on what you do.
     
  5. Spacemonkey

    Spacemonkey

    Joined:
    Oct 24, 2008
    Posts:
    89
    Ah okay, thanks for the heads-up :) I do want characters to be able to influence the positions of eachother, but I'd need to be able to have total control of that influence, which direction to push the character away, speed and so on. I'll do some experimenting and see what fits.
     
  6. Mingo

    Mingo

    Joined:
    Nov 14, 2010
    Posts:
    39
    I'm digging up an old thread here, but it's better than starting a new one and this thread came up on Google while looking into performance reports for the character controller, so maybe it'll help somebody else:

    If you intend to have many (30+) game objects, using the character controller and its movement functions will destroy your performance on a desktop gaming computer. Using a rigidbody or adjusting the transform manually will perform MUCH better. The above quote is optimistic, at best.
     
unityunity