Forum rules - please read before posting.

Configuring Pickup object

Hi there. For the project I'm working on, we want to be able to pick up a document and read it without switching to a UI (menu) system. As we want to be able to zoom in/out and rotate it, I've been using the pickup system with an interaction to give us additional functionality. Currently when the player picks it up, I set the document to be a child of the first person camera. This seems to do the trick, but I have a couple of questions

1. If I look around after picking up the document I seem to automatically drop it - why is this?  I thought it may have something to do with the doc colliding with the player, but I've ticked the ignore Players collider and the problem persists.
2. When the player releases the document I need to un-parent it from the player but I'm not entirely sure if this is possible given how I'm approaching the problem?

Thanks for any help!

Comments

  • 1. Are you letting go of the mouse button when looking around?  That will cause any PickUp object to be dropped.
    2. You wouldn't have thought you'd have to parent the PickUp in the first place, since the object will always be set to the position of the mouse cursor anyway.  Why are you having to do this?
  • No not letting go, it's kept down. I wondered if it was the break force, but I've increased that and it doesnt solve it.

    The reason I wanted to parent it was so that every time an item is picked up, I can put it a defined offset from the camera so it's consistent.

    Perhaps I'm approaching this the wrong way?
  • A defined offset from the camera, yet you want to be able to zoom in and out.  Sorry, I'm confused about what you're after with that one.  But parenting it to the camera is definitely against how it's designed to operate.
  • AntAnt
    edited April 2016
    Sorry for the confusion - my bad! To clarify what I'm after

    1. When I pick the object up, I want the object to be closer (a higher zoom) than the default, but still allow the player to zoom in further or zoom out.
    2. I still want the object to be rotatable

    I thought I could do this with an actionlist triggered by the interaction, but I'm unsure whether it's possible to detect when the item is released in this manner (in case there are elements I need to reset - for example I may want to constrain the player from moving during this, then obviously reinstate that when the object is dropped.

    Thanks
  • I will have to think about how you can set the starting zoom distance when an object is picked up.

    As for running interactions when grabbing/dropping, I will add custom events for these situations.  This'll give you full script control over what happens when the player picks up or drops an object.  If you want to simply run an ActionList, you can simply run its Interact() function.
  • Fantastic - thankyou.
  • Hey Chris, I notice in the release (version 1.51c) you added 'Events that can be called when moveable objects are grabbed and dropped' but I can't find the actual event in EventManager?

    Thanks
  • They're called OnGrabMoveable and OnDropMoveable - are they not there in the script?
  • Nope, searched and can't find them. I'm assuming they'll be in EventManager? The about text says version 1.51 - but I imported most recent version so I'm assuming that's correct?
  • No - the most recent release is v1.51d.  Make sure you click "Download" before "Import" within the Asset Store window to grab the latest version.
  • AntAnt
    edited April 2016
    Hmm..I don't understand. I don't have a download option for Adventure Creator (I do for other packages that I haven't yet updated). To test, I downloaded Adventure Creator into a new project but OnGrabMoveable and OnDropMoveable still aren't in the source code.

    When I click menu Adventure Creator 'About' I'm still seeing 1.51. The changelog and manual are both saying 1.51 (not 1.51d).  Howeever, the release notes beside 'Import' say 1.51d
  • Strange.  And what version of Unity are you using?
  • It gets stranger! I tried it on a seperate machine yesterday morning and same result. However, I logged out of my Unity account, then back in last night (around 10pm GMT) and the update appeared. Not a problem I've encountered before! 

    Using Unity 5.3.4.f1 (Personal). Thanks for the help!


  • AntAnt
    edited April 2016
    In terms of using the event - what's the best way to approach this? So I want the object to be positioned in front of the camera, at a closer zoom than normal,  but still be able to zoom in/out and rotate the object.

    Normally I'd just put the object at an offset from the camera and perhaps change the FOV or object position with inputs (if I wasnt using AC). Looking at Grab() function in PlayerInput it looks like I might be best to overwrite this rather than listen for the event?

    What's the best approach for this?

    Thanks

  • Something so seemingly simple is actually quite complex, and I can't actually guarantee your success with this without making some changes to the source code.  First of all I would definitely recommend snapping the object to the centre instead of lerping - worry about that later.

    The PickUp object works by attaching a FixedJoint whenever it's picked up - you can see this in Moveable_PickUp script.  It may be that manipulating this position is enough, but it's private at the moment.  Change it to public so that you can amend it - if you have success with that, I can consider making it public officially.
  • I remember programming something simular to what you want in my last game.

    I did it, but remembering the original transform of object, then mopving it to an empty game oject closer to the cam, activate a script that contained the code to rotate it etc, and then naturally, place it back at the original transform when done.

    wasnt to hard tbh
  • Klarax - I actually tried this approach before - did you call your script from an actionlist triggered from the interaction with the object? Also, once you pick something up it creates a fixed joint - did you disable this?

    Chris, I think rather than moved the fixed joint, you need to move the object to the desired location prior to creating the joint so I'm going to try that.
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.