Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by andrew_cs · Jan 23, 2014 at 06:07 AM · movementrigidbodycharactercontroller

3D RPG Character Movement

The problem:

I am working on a 3D RPG and am currently stuck trying to decide how to allow the player to move their character throughout the world. I've spent the last few days reading about CharacterController and the Rigidbody, but I can't seem to make a clear distinction about what I need to do. I don't want to get too far into this project and then realize I've wasted a bunch of time and effort since I used the wrong movement approach so I'm looking for some experienced input.

Goals:

In the game I want the character to be able to move forward, backward, strafe, turn, jump, walk, swim, run, go up and down stairs/slopes, be affected by "gravity", and possibly other things that you do in a 3D RPG. I don't want the character to affect the position/movement of scenery/objects in the game when ran into, I don't want enemies to affect the position/movement of the character when ran into, and I don't want the character to affect the position/movement of the enemies when ran into. I do want to prevent the objects/scenery, enemies, and character from moving through each other. I want to be able to turn gravity on/off or ignore when needed for swimming/spells/other. There would be very few instances that physics simulations would be required - they would be very simple and could be accomplished through scripting without the physics engine if need be (player being thrown back in a simple arc from explosion). Side note - If I extended this to multi-player I wouldn't want players to collide with each other.

My thoughts:

I don't know if a CharacterController would suite my needs since it's limited to the capsule collider. I wonder if later I would want a mesh collider on my character since it will have limbs/joints/etc. Another thing that I don't know is since I don't really need physics (aside from preventing objects from moving through eachother) would I even need a mesh collider, or would I still need it to prevent all parts of the character from going through other objects? The CharacterController does come with a lot of pre-built functionality that I'm looking for, but it seems that the rigidbody would be easier to modify for my purposes. Since the controller is pre-built maybe there are some things that I want to accomplish that wouldn't be possible due to how it's set up?

The rigidbody is the way that I felt I should go. I like being able to switch gravity on/off easily. However I don't know how to set up the player, enemies, and other objects to achieve the functionality that I want. These are some of the things that I did with a cube w/ rigidbody and my character w/ rigidbody. Used freezed rotation so the player doesn't fall over while moving or hitting the wall while the player is non-kinematic.

  • Kinematic wall and kinematic player - Pass through each other, neither prevents the other from doing so, this is expected.

  • Kinematic wall and non-kinematic player - Wall isn't moved which is great, player bounces off of wall slightly which would need to be fixed. If using this approach I don't know what I would use for the enemies as far as the rigidbody setup. Since the player is non-kinematic it could be affected by enemies colliding into it which I don't want.

  • Non-kinematic wall and kinematic player - Player knocks over the wall, freezing the walls rotation makes it just get moved without falling over, freezing position and rotation causes the player to move through the wall as if they were both kinematic.

  • Non-kinematic wall and non-kinematic player - Player knocks over wall, freezing rotation on wall causes it to just be pushed back, freezing rotation and position on wall causes it to launch the player away, and freezing the position and rotation on both the wall and player cause them to move through each other like two kinematic rigidbodies.

If I set my character to kinematic then I can easily move the character around like I want to except for the gravity (which I'm assuming could somewhat easily be simulated). I was using rigidbody.MovePosition to attempt all of this and I believe that approach is a correct one. I feel like there is a way to do what I want with the rigidbody and I also feel that the rigidbody is the correct way to go. Is one of these set-ups preferred or optimal to go with and modify?

Am I missing something fundamental here or a small key piece of info? I thank any help/responses in advance and am open to all suggestions. Also if anything I said here is inaccurate please let me know, it might help me solve my dilemma.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Turning a rigidbody controller into a character controller (almost) 1 Answer

Rigidbody Jumping for Character Controller 1 Answer

Character Controller Follow me in the air 1 Answer

Using rigidbody for collisions only, not movements? 1 Answer

How to let a GameObject generate force but not be affected by certain forces? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges