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 Dinart Filho 1 · Nov 13, 2010 at 06:03 AM · collidercharactercontrollerdisable

Turn On - off character controller script, is there a way??

I am trying to do my character grab and launch objects and enemies but to do it with enemies I need to turn off, and on again character controller, is there a way (js) ?

Thanks in advance!

Comment
Add comment · Show 2
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 Ostagar · Nov 13, 2010 at 06:27 AM 0
Share

Do you mean the CharacterController component or a script that controls your character? They are two separate things.

avatar image Dinart Filho 1 · Nov 14, 2010 at 02:04 AM 0
Share

I mean the CharacterController component, is there a way to turn it On or Off?

the problem is: I have a character and one of his actions is to pickup things and enemies and launch. With things my code works well, but since the enemies have the CharacterController component, they cannot act as common rigidbodies when they are grabbed and launched, just if I remove the component, is there a way to cancel the CharacterController effects? (turn on/off) ??

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Anxo · Jun 19, 2011 at 01:57 PM

 function Update () {
     if(Input.GetButtonDown("Fire1"))
     {
         var myController : CharacterController = GetComponent(CharacterController);
         Destroy(myController);
     }
     if(Input.GetButtonDown("Fire2"))
     {
         gameObject.AddComponent(CharacterController);
         
     }
 }
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
avatar image
-3

Answer by ant123 · Jun 19, 2011 at 12:43 PM

same question

Comment
Add comment · Show 3 · 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 Anxo · Jun 19, 2011 at 01:56 PM 0
Share

dont use answers to post a comment

avatar image LegionIsTaken · Jun 19, 2011 at 02:24 PM 0
Share

RTF$$anonymous$$, Amirite?

avatar image ant123 · Jun 20, 2011 at 11:27 AM 0
Share

WELL!!!! obviously when i mentioned i had the same question, there was an HT$$anonymous$$L error on this website, because the first post was displayed, with no answered ander it, that is wy i wrote "same question"... in fact i noticed alot of pages where i click and only the first post is displayed. will see why. besides my high contrast web page setting might make the comment/answer system less visible and i am a noob. thanks

avatar image
0

Answer by tikot · Sep 08, 2012 at 10:31 PM

The bast way to do this is in Character script if using unity CharacterMotor script

In CharacterMotor.js Change

 var canControl : boolean = true;

To

 static var canControl : boolean = true;

Use

 //turn character off
 CharacterMotor.canControl = false;
 
 //turn character on
 CharacterMotor.canControl = ture;
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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Character collides with object so text pops up 0 Answers

CharacterController vs Rigidbody (photo included) 2 Answers

Animation Script not working. 1 Answer

Character Controller Object Randomly Falls Through Colliders 3 Answers

Audio play when object hit collision. 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