Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

AAA Quality Adventure Camera Released!

Discussion in 'Assets and Asset Store' started by Tryz, Dec 21, 2013.

  1. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    Thanks @FenixOfGreen ,

    There's nothing that will spring the pitch back automatically, but you can add your own code to do it.

    In both cases, you can use the SetYawPitch() function on the motor.

    You can write code something like this:
    Code (CSharp):
    1. CameraController lCameraRig = gameObject.GetComponent();
    2. YawPitchMotor lYawPitchMotor = lCameraRig.ActiveMotor as YawPitchMotor;
    3. if (lYawPitchMotor != null)
    4. {
    5.     lYawPitchMotor.SetYawPitch(0f, 0f);
    6. }
    There's a section in the User's Guide where I talk a little bit more about the code and give some small examples:
    http://www.ootii.com/Unity/CameraController/CCUsersGuide.pdf

    That should help.
     
  2. limpin_jezus

    limpin_jezus

    Joined:
    Nov 20, 2015
    Posts:
    8
    Has anyone modified a motor to orbit an object like the 3rd person motor, but also have vertical camera movement? I need that rig and my attempts at creating a custom motor so far are not working so well. I've been trying to modify the 3rd person motors and something is springing the camera back to the original vertical position every frame. I'll continue banging on it, but if anyone has done this previously I'd rather not reinvent the wheel. :)
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    I'm not sure what you mean by "also have vertical camera movement"?

    The 3rd person motors primarily use 3 values: yaw, pitch, and distance. Think of the center of the sphere being the anchor + anchor offset. The yaw and pitch determine the direction from the center. Then, the distance is the distance the camera is from the center along that direction. The camera basically stays on the surface of a sphere that surrounds the character.

    So, I'm not sure what vertical camera movement would be (other than pitch). If you can explain that more, I might be able to help.
     
  4. limpin_jezus

    limpin_jezus

    Joined:
    Nov 20, 2015
    Posts:
    8
    Vertical movement without a pitched angle. Just simple up/down with a level camera. As an example, with the third person motor with zoom enabled, you can only zoom in on a fixed point of the viewed object (the center). I'd like to be able to move the camera up and down and zoom at that 'level' without an angle. In this view here, if I pitch up and zoom, it will always only zoom in on the stomach, no matter the pitch angle. I need to be able to zoom in on any part of the model.
    upload_2018-5-22_23-58-56.png

    upload_2018-5-22_23-59-24.png
     
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    Ah... I see.

    What you really want to do is modify the anchor position and/or the distance.

    As I mentioned, the camera is going to look at the center or focus point; that's the anchor + anchor offset. So, you want to lift the transform that is the anchor or change the anchor offset value.

    To fit with your pictures, I'd also change the distance value at the same time.


    The camera motor is just looking where you tell it. So, in my picture, the anchor is the same, but I shortened the offset (y-value) and shortened the distance.

    With that the camera does "move vertically" because the focus point (anchor + anchor offset) moved vertically.
     
  6. limpin_jezus

    limpin_jezus

    Joined:
    Nov 20, 2015
    Posts:
    8
    Perfect! Thanks for the pointers. Now it works like a charm!! I was able to adjust the Offset, in RigLateUpdate, modifying the 3rd Person Fixed motor as such:

    Code (CSharp):
    1. if (_UpActionAlias.Length > 0 && RigController.InputSource.IsPressed(_UpActionAlias))
    2.             {
    3.                 RigController.AnchorOffset = RigController.AnchorOffset + (Vector3.up * (_VerticalSpeed * rDeltaTime));
    4.             }
    5.  
    6.             if (_DownActionAlias.Length > 0 && RigController.InputSource.IsPressed(_DownActionAlias))
    7.             {
    8.                 RigController.AnchorOffset = RigController.AnchorOffset + (Vector3.down * (_VerticalSpeed * rDeltaTime));
    9.             }
    Now to add some clamping to keep the object in focus...
     
    Tryz and hopeful like this.
  7. FenixOfGreen

    FenixOfGreen

    Joined:
    Oct 2, 2017
    Posts:
    20
    Thanks for the help, but ill be honest, im completely lost. I went through the Documentation on code and through the code it self but i just cant seam to follow it. Maybe im stupid and missing something but i have no idea where to put the code you suggested.

    btw im using the 3rd person follow camera if that makes a difference
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    You said you wanted to have the pitch spring back to the default when you release the mouse (or some other event).

    So, you put the code where you would respond to the release of the mouse. I don't know your game code, but I'm assuming you have a Monobehaviour somewhere that has code watching input. You'd put the code there in response to the release of the mouse.
     
  9. FenixOfGreen

    FenixOfGreen

    Joined:
    Oct 2, 2017
    Posts:
    20
    Okie Dokie, Thanks for the help. I put the code you suggested into the CameraControler. Will it work? Beats me, again im kinda clueless by nature unfortunately. The only problem is the red squiggly under GetComponent. Any idea on how to fix it?
     

    Attached Files:

  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    No. You don't want to modify my code.

    You have to create your own component (called a Monobehaviour in Unity).

    Unfortunately, the feature you want isn't something the Camera Controller does. The code I provided will do it, but it sounds like you'll need some Unity coding knowledge.

    You may want to check out some of Unity's videos on programming. That will explain what a Monobehaviour is and how you can customize Unity's gameplay.
     
  11. FenixOfGreen

    FenixOfGreen

    Joined:
    Oct 2, 2017
    Posts:
    20
    i do know unity code, im just crap at it lol. ill figure it out eventually. Thank you for the help
     
    Tryz likes this.
  12. jovino

    jovino

    Joined:
    Jun 5, 2013
    Posts:
    19
    Hello Tryz

    I am a happy new customer, used to work with **other developer** frameworks, your modular architecture and composition vs conditional code (motors, for example) is really refreshing, thank you for the great tools.

    I am playing now with a small fps project, and, while I'm at it, an idea has come to my mind: how can i get a weapon camera with Ooti assets so i can drop all this mess too? :)

    I know your packs are third person focused, but I think a weapon camera with some procedural motion it's not a big problem for you, maybe as a new pack? What do you think about it?
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    Hey @jovino , Thanks! :)

    What do you mean by a 'weapon camera'?

    With the camera motors included, you should be able to get most of the views you want... or pretty close. Describe what you mean a bit more and maybe I can help.
     
    jovino likes this.
  14. jovino

    jovino

    Joined:
    Jun 5, 2013
    Posts:
    19
    This is what I mean by "weapon camera"



    Usually rendered in a separate layer together with the main camera, so you can get a different FOV to get that "modern fps" look
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    2,807
    Got it.

    Usually this is a second camera put on a different layer. The world is rendered by one camera and ignores the gun while the other camera draws on top of that and ignores the world. This way if the character is against a wall, the gun doesn't get clipped by the wall.

    That's not something the CC would do since you would do that by setting the multiple cameras and layers they render. The CC would manage the position and rotation. You'd just add two cameras to the setup vs. the normal 1 and it should all work now.


    I believe I talk about this in my Shooter Motion Pack docs. I'm on vacation right now and don't have the link handy.
     
  16. jovino

    jovino

    Joined:
    Jun 5, 2013
    Posts:
    19
    Oh, come on, enjoy your vacation and stop working now!

    I found the link already, https://ootiigames.com/?p=905.
     
    hopeful likes this.
  17. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    256
    Is there a way to setup the controller to act like a typical MMO camera? The 3rd person (fixed) is almost what I'm looking for, except that the camera doesn't follow the character rotation (q/e) and the scroll wheel zooms instead changing the camera distance.
     
  18. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,514
    So just opened up the third person view demo and pitch/yaw speed are having zero effect.

    Also, I can't have the camera as a child of the controller. Is there built in support for simply telling your controller which camera to control?
     
  19. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,514
    Ok pitch/yaw speed work fine. It's that the active motor isn't the selected motor by default, so I wasn't modifying the correct one.
     
  20. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    266
    Just downloaded the asset and loaded it into a clean 2018.1 project on MacOS. I must have the worst luck because this is the second asset in a row which does not do what the demo says it should do, out of the box.

    The 3rd-person demo says on the screen:

    WASD = Move character (this works)
    QE = Rotate character (this works)
    LMB = Orbit character (this works, a bit slow, probably adjustable)
    RMB = Rotate camera and character (this behaves identically to LMB, moving camera only)

    The PDF suggests MMB also does "Aim" but it does nothing.

    If I move the character, the camera creeps along very slowly until it is eventually behind the character, like a truck hauling a trailer. But if I stop moving the character, there is no spring or momentum to the camera to bring it behind the character at all. The RMB does not rotate the character at all. I found the Jones object has a "Rotate to Input" feature which if enabled will SNAP the orientation of the character to wherever the camera was set independently on the next application of WASD, a very clunky feel.

    The "free flight" demo does nothing, for keyboard nor mouse. This error is the culprit:

    ArgumentException: Input Axis MXRightStickX is not setup. ...
    com.ootii.Input.UnityInputSource.get_IsViewingActivated () (at Assets/ootii/Framework_v1/Code/Input/UnityInputSource.cs:195)

    And the "showcase" demo should be renamed "spline" as that's all it's showing off. The spline demo transitions to third person.

    So what am I missing?
     
    Last edited: Jul 1, 2018