Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bone Controller [RELEASED]

Discussion in 'Assets and Asset Store' started by Tryz, Feb 16, 2015.

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,399
    Hey @dmenefee ,

    You could also tap into the MC's events and listen for specific motions to start/end.

    The animation events might give you more precision, but they won't tell you what you're grabbing for. So, you'll want the motion to tell you that and pass that info to the bone controller. Check out my post on interacting (and the BasicInteraction motion). I think that will give you a good foundation to start from.

    Object Interactions
     
    dmenefee likes this.
  2. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    142
    Thank you! I’ll try yoursuggestions.
     
  3. rocksockm

    rocksockm

    Joined:
    May 28, 2013
    Posts:
    11
    Hi, All. I recently started working with the Bone Controller and it's been great.

    But I'd like to ask if anyone knows the best way to enable and disable a LookAtMotor target? For example, clearing the lookat so the head/neck/spine blend smoothly back to their animated rotations.

    If I set the weight to zero or set the Enabled to false, there is always a slight pop. The head seems to lerp back in addition to the pop, so I'm guessing something is getting turned off.

    Now that I type this out, I'm wondering if the constraints are getting disabled and my constraints are tighter than what the animation is doing....hmm.

    But any insight would be appreciated! Thanks!
     
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,399
    Hey @rocksockm ,

    Before disabling the motor, try ramping down the "Weight" property.

    I don't have it in the "LookAtMotor" demo, but check out the "FingerPoseMotor" demo. On it, I have a slider for weight and as you move it, it ramps the motor's impact from 0% to 100%.

    You can do the same this with the LookAtMotor like this:

    Code (CSharp):
    1. mHuman = GameObject.Find("Human");
    2. LookAtMotor lHumanMotor = mHuman.GetComponent<BoneController>().GetMotor<LookAtMotor>();
    3. lHumanMotor.Weight = 0.5f;
    The other option is to use an invisible "look at object" that you are always looking at. Then, you can move that object to focus the character's head onto another position or straight ahead. It's similar to what I do with the red ball in the demo. Just make the red ball invisible and move it where you want your character to look.

    I hope that helps.
     
    rocksockm likes this.
  5. rocksockm

    rocksockm

    Joined:
    May 28, 2013
    Posts:
    11
    Thank you, @Tryz , I implemented some functions to handle the ramping of weights.

    I have another question though. I've started using a PoseMotor in addition to my LookAtMotor and it looks like the pose motor completely overrides the lookat's motion, even if the "weight" is set to zero. If if it weren't zero, I'd love to use the PoseMotor for things without having it override the lookat. Is there a way to make sure they live in harmony with each other?
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,399
    Hey @rocksockm ,

    The motors don't stack rotations up on the same bone. Instead, the last motor in the list that affects the bone wins.

    In your case, the Pose Motor is probably the last one and it can't take the "motor rotation" of a previous motor and use that as the default rotation (for a weight blending). It will use an animation rotation, but not a rotation from a previous motor.

    In doing some quick tests, it won't be a simple "fix" to use a previous motor rotation as the base. So, I need to think more on how I'd do that given the architecture.
     
  7. LNMRae

    LNMRae

    Joined:
    Dec 28, 2012
    Posts:
    48
    Hi, I'm having a bit of a strange issue. I'm not able to select bones. I can set them up and they're visible in the scene view just fine, but anytime I try to select one, it always prioritises selecting anything else in the scene. I'm using Unity 2020.1.9 with URP.

    I saw someone else say they had this issue but I didn't see a solution. They mentioned they thought it was a camera issue but changing my camera settings didn't change anything. Any ideas on how to fix this?
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,399
    Hey @LNMRae ,

    I just started a new U2020.1.7f1 project and everything worked.

    I know it's not the most intuitive, but did you press the "Hand Tool" first? Since the bones are not true Unity objects, we have to do this before the bones can be selected with the mouse.

     
    LNMRae likes this.
  9. LNMRae

    LNMRae

    Joined:
    Dec 28, 2012
    Posts:
    48
    Thank you for the quick reply on this and sorry for my late response. This was the issue for me, didn't even think of using the hand tool.
     
    Tryz likes this.
  10. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    525
    Hi there, BC 0.587 (more precisely Framework_v1) is throwing errors regarding a missing InputSystem, even though the latest Input System (1.02) is installed. Since this is a show-stopper, what can I do?
     
  11. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,399
    I'm sorry for the hideous delay. I got back home from 2 years in Japan and things have been crazy.

    It sounds like the issue could be the assembly definition files not having the right references. That can happen when the Input System is imported.

    Please check out this post (step 4) and make sure the "Demo" and "Editor" assembly definitions include the "ootii" library.

    Unity Input System

    Again, I apologize for the huge delay.
     
    umutulutas and AGregori like this.