Search Unity

Advice for Movement Versus Attacking using CC/Rigidbody

Discussion in 'Scripting' started by Eyeshock, Sep 16, 2012.

  1. Eyeshock

    Eyeshock

    Joined:
    Sep 7, 2012
    Posts:
    60
    I'm writing a 3 player Co-Op networked RPG using an isometric camera angle. (Think Secret of Mana, Ys Origins, etc.).

    So I wrote a custom movement script that uses a Character Controller to move a prefab. The movement script changes the direction and animation of the model like you'd expect, and I apply this movement script to all things (enemies, players, destructible treasure chests, basically anything that has a 'health bar'). I send the movement scripts messages that change the value of HorizontalMovement and Vertical Movement (enumerations) and then call controller.Move. So as is, it works perfectly for an isometric Co-Op RPG.

    However, not all my monsters are going to be 'capsule' shaped. And some destructible objects are fairly large, and when destroyed or damaged I'd like them to fall over/ fly off in the distance. I'd also like to apply a ragdoll effects to monsters that are K.O.ed. There's also a question of fighting boss monsters.

    So to recap, I want to:

    1. Be able to walk on huge boss monsters to damage weak points like head, etc.

    2. Ragdoll K.O.ed monsters and players (they lose control at this point)

    3. Attack objects and have them respond to the physics of being hit.

    4. Have monsters react to being hit. (hit above torso, play 'damaged' animation, have them leer back appropriately according to physics).

    The reason I need advice: there's lots of varying opinions on how to apply these effects. I see people say there's too many problems with using CC and Rigidbody components on the same prefab, but they never go into detail. So my questions are

    1. Can I get the above effects by adding Rigidbody, using CC for moving the prefab and Rigidbody for collision/physics?

    2. What problems do I face when having both these components attached? I attached one just to test it out and played with all public actions and nothing changed.

    3. Are there any common networking problems for Rigidbody (beyond the obvious 'physics' issue with not synching transforms)? I already have multiplayer working in my current build. I am tracking the position of the player's prefab and not a whole hell of a lot else right now.

    Here is a small download for my current build, please ignore the sample monsters jitteryness (it's related to my FaceDirection() function. They're trying to face only 8 directions like the player and it ends up looking silly.)
    http://www.eyeshock.com/screenshots/CymbilSpellcraft.rar

    You can pretty much leave everything in the options 'as-is' to start and just Host Game, then Start Server, Start Game. The other 'levels' are just random scenes I threw in to make sure the select level option worked. WASD to move, Space to Jump, Hold left-shift to Sprint.
     

    Attached Files:

    Last edited: Sep 17, 2012