Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Rotating an Object

Hi again all,

I've followed the tutorials and I have managed to get my player to pick up an object and rotate it freely and it works a treat (once again Chris the fact that I am able to get this to work is a true testament to how awesome AC really is)!

the problem I am now having though is that to do the above I simply used the cursor and would pick the item up using my cursor however I have a 3rd person game and as such I need my player to move up to an object, you click the action button for the player to pick up the object (I'm using FinalIK plugin to handle that aspect of things) however I am hoping that there is then a simple way that I can rotate the object in a controlled manner whilst the player has the object in their hand?

Essentially I'm trying to achieve something similar to LA Noire when the player inspects certain items that they pick up (see 51 seconds into this video where the player inspects a bloody wrench https://www.youtube.com/watch?v=CDXXQORXXTQ). The limits of the rotation would have to obviously stay within the characters hand limits (so actually would I be rotating the object or simply rotate the hand instead)?

Many thanks in advance for your help, as with everything I have tried myself to come up with a solution but after nearly a week I'm giving up and asking lol.

Comments

  • edited July 2017
    As a fan of that game, I'm familiar with the mechanic you're describing - however I'm afraid that's beyond the scope of AC's PickUp system.

    If you want to try doing it with AC in combination with FinalIK and some custom scripting, I'd instead recommend looking into the Draggable type - it's Rotate Only mode means that you can't move it, meaning the player can't accidentally throw it off-screen or something, and you have full control over it's position which you could feasibly manipulate via the OnGrabMoveable / OnDropMoveable custom events.

    However, I feel it would be better to write a custom implementation from scratch - as there is much more to consider beside rotation constraints.  Animating the pickup to a default rest pose, putting it back in the same spot, etc, are all extra considerations.  You can disable AC while your own system is running easily enough using the Engine: Manage systems Action.
  • @ChrisIceBox

    Thanks again for the helpful response, I've unfortunately been away from my PC for a few days now however I hope to give your advice a try tonight. I think it will take some effort to get this working in a way that looks and feels good enough - worst case I can simply just have the object on it's own be fully interactive (so the player can freely rotate and inspect the object whilst it is in a fixed space as opposed to seeing the player hold onto it and inspect it like LA Noire). Always good to have a Plan B, I'd love Plan A to work as I too loved LA Noire and I believe that inspection mechanic works great however Plan B is something I can guarantee I can get working easily and will still look and function correctly.

    Thanks again Chris!
  • edited July 2017
    Well miraculously I seem to have gotten what I wanted to work relatively easier than I first thought, I'm so happy that I may try and upload a vid/gif of it working as desired once fully polished!

    For anyone interested I mainly used the FinalIK plugin to get what I wanted (FinalIK handles the picking up of the object and rotation of the players hand while holding an object) and I used AC as way to control the whole thing via action lists. I don't see any point explaining much further since it was mainly via use of a different plugin to AC however anyone interested feel free to ask me.

    Even though FinalIK was used for the core functionality of what I wanted to achieve I'm adamant that I wouldn't have been able to achieve what I did using FinalIK alone because AC still provided the excellent framework to enable a non-programmer like me to pull everything together and actually get things to run and work as and when required so thanks again Chris! :)
  • @mjbcfc There is a custom Action for calling Final IK interactions written by AC users Snebjorn and PurpleShine, you can find it on the wiki. I've gotten plenty of use from it so far, trying to do the same as you (even inspired form the same place: LA Noire!).
  • edited July 2017
    @Deckard_89

    To be honest I don't think I've ever checked out the Wiki (I know, what an idiot I am lol). I'll check this out, I have managed to call the required FinalIK interactions though using my own custom scripts however I am certain that a custom Action from some real programmers in this community will be of much more use to me so I'll still check these out.

    As for the solution I went with I used the AimIK component, I attached that to the players hand (I think I included the forearm in the bone hiearachy along with the hand so that it looked more believable). I would start with the AimIK component disabled however when the player picks up the object (using FinalIK) I would then enable the AimIK component. The target that the AimIK looks at is, at the moment, a small sphere attached to the object as a child of that object. The target is then moveable via a custom script that is dictated by the CursorHorizontal and CursorVertical axes (so that this can be moved via the mouse or even a controller since I've mapped both Mouse Movement and Right Analog Stick to those respective axes).

    Within the custom script that controls the movement of the target there are limits within that so that the target only moves within a confined area to ensure that the players hand can't contort into unnatural positions. This element is still not perfect (the players hand is still turning just slightly too far however I'm not spending time tweaking this at the moment since it is working fine for now and I'm just happy that I managed to get the limitations working and the players hand doesn't turn 360 degress unimpeded lol).

    Here is a quick video, obviously missing a hell of a lot of polish and it is a simple test scene however I am so pleased that I've even got it working after only 2 nights of working on it so to me the video looks amazing and is a worthy GOTY winner haha!



    You can see the target of the AimIK visible in the video, it is the small sphere with the default material on it - obviously this will be invisible going forward however in this initial testing phase (and for showing to yourself) having it visible is obviously beneficial. I also need to tweak the hand poser as the sphere object doesn't quite sit right in the hand when picked up (however the sphere is a placeholder and not an object that the player will actually be able to pick up so no point in me tweaking this - I'll just to make sure I'm more thorough when I integrate this onto an object that the player will actually be able to pick up)!
  • edited July 2017
    Excellent progress, @mjbcfc!  I'm sure the community would love to see anything you're happy to share on the wiki.
  • Nice! I like your use of Aim IK, that's a clever angle. I don't think I can go that route though, as I'm using Opsive's Third Person Controller and Aim IK is used for, well, aiming (I have combat in my game). I have the character examine objects once he's picked them up by using Adventure Creator's Transform / Rotate Action (this is automated though, not player controlled).



  • @Deckard_89

    Ah yes, makes sense. I wonder though if you're able to have 2 separate AimIK components and simply switch between them? Part of my solution I actually start with the AimIK component disabled and only enable it when I pick an object up so you should therefore be easily able to enable/disable both to switch between the two modes - unless you can't add two AimIK components at all?
  • Hmm, never tried adding duplicate components. I could give it a shot, though something tells me it's sort of an unwritten rule to not have duplicate components on one game object. Not too much of a concern for my current project anyway, but in the future I was planning a sort of detective-ish game where manually examining objects is important. For that I might have separate characters but using the same model - one for "detective work" where Final IK's interaction system is used heavily, and one that is used for combat scenes and doesn't need the rotating/examine thing.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.