playMaker

Author Topic: [SOLVED] enable/disable character controller w/fsm?  (Read 6300 times)

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
[SOLVED] enable/disable character controller w/fsm?
« on: May 11, 2012, 12:01:27 PM »
Does anyone know if there is an action that can be used to enable/disable the character controller?

Thanks!
« Last Edit: May 18, 2012, 11:15:09 AM by Alex Chouls »

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: enable/disable character controller w/fsm?
« Reply #1 on: May 11, 2012, 12:12:04 PM »
I thing the enable/disable FSM is good for you.
Bye

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #2 on: May 11, 2012, 01:47:28 PM »
No, I think that does not work. I need to disable the character controller, not just the FSMs attached to it.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • View Profile
    • Blog
Re: enable/disable character controller w/fsm?
« Reply #3 on: May 11, 2012, 02:11:06 PM »
Sorry maybe remove component?
Bye

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #4 on: May 11, 2012, 02:29:52 PM »
No worries! I've created a custom action that lets us enable and disable the character controller:

http://hutonggames.com/playmakerforum/index.php?topic=1556.0

(Now that I'm starting to understand how to create actions, this is getting to be way to much fun!)

:)

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 228
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #5 on: May 11, 2012, 02:45:36 PM »
I found that using an "set property" action to disable it works pretty well too.

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #6 on: May 11, 2012, 03:51:59 PM »
Looking through "set property" right now. How did you access the character controller? I don't see it listed in the property list. I do see collider and rigidbody. And there is active, but this seems to be only for the entire game object.
« Last Edit: May 11, 2012, 04:01:33 PM by amaranth »

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 228
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #7 on: May 11, 2012, 03:54:47 PM »
I just disabled the entire thing.  I think "enabled" was under the "inherited" sub tab.


amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #8 on: May 11, 2012, 04:02:24 PM »
Ah gotcha. Nah, I can't do that. I've got to keep my creature visible, but I can't have it trying to escape my mouse while I'm dragging it around on screen. :)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3632
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: enable/disable character controller w/fsm?
« Reply #9 on: May 12, 2012, 01:45:11 PM »
You should be able to use Enable Behaviour:
https://hutonggames.fogbugz.com/default.asp?W54

Or Set Property - drag the component into the Target Object field and set the enabled property.

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: enable/disable character controller w/fsm?
« Reply #10 on: May 13, 2012, 06:12:56 PM »
You should be able to use Enable Behaviour:
https://hutonggames.fogbugz.com/default.asp?W54

Or Set Property - drag the component into the Target Object field and set the enabled property.

Hi Alex, when I use Enable Behavior, Character Controller is not in the Behavior list. It does show Character Motor, but that's it.

I also tried Set Property, but again, Character Controller was not in the list. I did search through a few of the options, but I could not see how to attach Character Controller to the Object field.

My simple action that I created worked, but I'm still curious if there is another way to get to the Character Controller.
« Last Edit: May 13, 2012, 06:20:26 PM by amaranth »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3632
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: [Solved] enable/disable character controller w/fsm?
« Reply #11 on: May 15, 2012, 10:50:32 AM »
My mistake - a Character Controller isn't a Behavior, it's a Collider.

Apparently the way to disable a Character Controller is to set Detect Collisions to false:
http://unity3d.com/support/documentation/ScriptReference/CharacterController-detectCollisions

But your custom action also works? Checking online and running a couple of tests, it seemed that you can't use  enabled to disable a Character Controller...?

amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: [Solved] enable/disable character controller w/fsm?
« Reply #12 on: May 15, 2012, 02:29:52 PM »
Colliders, properties, aaahhhh! Head exploding. :D

Yup, my custom action is working. It's really just the EnableBehaviour action customized for a collider. The action is here if you want to proof it: http://hutonggames.com/playmakerforum/index.php?topic=1556.0

(disable collisions won't work for me. it would solve part of the problem. i needed to turn off collision, movement scripts, and gravity. loads of little things, so turning off the collider seemed the simplest solution. in my game, you can pick up creatures in one place and drop them in another. while i'm dragging them around with the mouse, I need for them not to wiggle, detect actions, or to drop w/gravity.)
« Last Edit: May 15, 2012, 02:39:42 PM by amaranth »