• 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 Dinart Filho 1 · Dec 16, 2010 at 09:31 PM · charactercontrollerparent

Character controller: Kill it for a while to Ride a machine?

Hello there. In my game I want my character to ride a machine/horse/thing so what I want is:

stop near the "device", push "Fire1" button and the character be riding the device.

What I did was to make the character (character controller based) be parented to the device, kill the inputs and let it be carried by the device.

Everything works almost fine but the device becomes crazy, even if i didnt apply anything to it, just rigidbody and collider.

how can I do it work????

Comment
Add comment · Show 1
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
avatar image FLASHDENMARK · Dec 16, 2010 at 09:51 PM 0
Share

Some times or at least that is what i have experienced. When i add a rigidbody to a object with a character controller, my object also tends to become wild. try taking the rigidbody of. Dose it still go nuts?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by BerggreenDK · Dec 16, 2010 at 11:06 PM

I would implement STATES into my script.

and in the Update() loop/event, you make a switch that only runs whats active in current state.

A state can be made with a simple variable. If you only have two states in total, you can just use a Boolean. But if you think you might have even more vehicles or activities I would recommend an Integer for state.

The state variable is just a "private variable" you keep within your object.

If you want pretty code, you can implement the state with an Enum for the state.

If you need an example, then look in my previous answers. Search by clicking on my profile name and check or be lazy: http://answers.unity3d.com/questions/24378/unity-design-patterns/30102#30102 :-)

Comment
Add comment · Show 2 · 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
avatar image Dinart Filho 1 · Dec 17, 2010 at 01:37 AM 0
Share

I meant something more specific, I did a state for my character (riding and !riding) but something really strange goes on.

$$anonymous$$y character becomes child of a child of the machine in the right place, the machine is a simple rigidbody, still unscripted, i just wanted to parent the character there and kill his controls, is what i did, but something really strange happens, the machine, father of all, becomes crazy and runs, jumps, rotates like a bull when somebody try to ride. Still Dont know what to do.

thanks

avatar image BerggreenDK · Dec 17, 2010 at 06:13 AM 0
Share

perhaps you would get better answers if you could provide us with some parts of your code? sometimes it makes it much easier to understand and fix.

avatar image
0

Answer by Dealzu-The-Wikid · Jul 11, 2014 at 05:14 PM

You have to make sure that what you are turning off is your character motor script, not the controller itself, since many things have @require component on them.. If you look very closely, when you pause the game, that component often turns right back on even if you have turned it off, causing the craziness(possibly) you were talking about! From what I understand, you need to instead make a reference to only the character motor portion of that script and enabling/disabling that. I know this answer is late, hopefully this can help people in the future trying to understand this type of thing though.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Prioritizing Player Animations 0 Answers

Click on an object and then edit the speed of my player? 1 Answer

Controller Stuck on Slope Walls 1 Answer

Can I prevent player through terrain when terrain height is modified at runtime? 1 Answer

CharacterControllers.package problem 2 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