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
0
Question by The_r0nin · Nov 24, 2010 at 02:51 AM · controllercollidersparenting

Multiple controllers on same Player object...

This is not quite a code question, but more of a capabilities/procedures question. My player object will have several different modes corresponding to land-based or air-based travel. These modes will be selectable by the player (and will change the mesh). I would like to use the character controller for the land-based movement (primarily because I am not secure enough in my coding skills to think I can handle all of the collisions as well as the standard controller can). However, I need the ability to change collider shapes (not possible with the character controller... it's always a capsule) as well as the controller to one more suited to airplane-style movement.

I've tried creating a player parent gameobject, parenting different meshes with their own controllers to it, and activating and deactivating them as needed. Because the controllers are on the meshes, only the mesh (and not the player object) moves. I can re-parent all of the other meshes (as well as the player object) to the "selected" mesh, but that is asking for code/controller issues.

There has got to be a more "elegant" solution. Any ideas on how I could swap between controllers, colliders, and meshes without having to destroy and instantiate them or swapping out tons of parent objects?

Any insights would be greatly appreciated. I'm at the point where I'm afraid I will have to jettison the character controller and just code the whole different sets of controllers together (in which case I'll probably be posting a ton of collision questions... hehehe)...

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by The_r0nin · Nov 26, 2010 at 03:13 AM

OK, I figured out an inelegant but workable solution. I created a player object with a script that selects between the various modes. I created three different objects that contain the meshes, colliders, and controllers for each of the three modes. I then cached (in the player script) the objects and renderers of each object.

When I want to change modes, I disable all of the mode objects and their renderers (using the cached variables), then enable (or set active) the mode object and renderer I want. I then move it to the player object position and parent the player object and camera to it.

Anytime I need to transmit info to the player (say reduce hitpoints due to damage), I Broadcast a message (still looking for a better method... I might cache the player object in each mode object) so that the damage script on the player object will be run.

Not the best solution, I'm sure... but the best I can come up with. Hopefully it will help someone else in my position.

Comment
Add comment · Share
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

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

No one has followed this question yet.

Related Questions

Piling up objects and transporting them 1 Answer

Pulling boxes 0 Answers

physics.OverlapSphere colliders 1 Answer

Help with Colliders? 0 Answers

Controlling child sprites with one animator? 1 Answer


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