Forum rules - please read before posting.

3D item inspection, rotating

Hi!

I would like to be able to inspect my inventory items so that I see the 3D object in the middle of the screen and I would be able to rotate it. Is there a built in function for that, which I haven't found yet? If not, what would be the best way to implement this, can I achive it by making an action list where I for example parent the gameobject so it's in the cameras view, disable character controlls untill I exit with a certain input? This way how would I be able to rotate the object also making sure I dont interact with anything else on the screen?

Thanks in advance for taking time to help :)

Comments

  • There's no built-in Action for this, no, but you can extend AC's ActionList system by writing custom Actions.

    You'd probably want a custom Action that does the builk of the work for you, e.g. spawns a 3D model, parents + positions it properly and so on.  For convenience, the RuntimeInventory class has a variable that's set to the last-clicked inventory item:

    AC.KickStarter.runtimeInventory.lastClickedItem;

    You could therefore read this item's ID number to determine what item was clicked, and then spawn the correct 3D model.

    As for disabling character controls, you can temporarily turn off any of AC's systems by using the Engine: Manage systems Action, so that you can replace them with your own rotation code.
  • I still need to work on this, but thank you, this gave me a good start. :)
  • So I managed to have to object positioned in front of the camera and I can rotate it. The way it works I made a Use interaction for the object, which runs a custom action script, this script does the parenting and enables my rotation script component on the gameobject. Now I get the following error: Instance of InspectRotate couldn't be created. The the script class needs to derive from ScriptableObject. InspectRotate is a script I wrote and added manually.
    Is this a problem? Because the script still works. Also in the use interaction I disable the hotspot and I would like to re-enable it when I end the interaction, which I do by hitting the right mousebutton. How would I react to that?
    What can I add to the end of this actionlist:

    image
  • I would need to see the full error message to give a proper answer, but if InspectRotate is in an Actions folder then take it out - AC will expect it to be an Action.

    To re-enable a particular Hotspot, record which one as part of your Custom: Inspect item Action, so that another custom script of yours can re-enable it (just call it's TurnOn function).  Alternatively, you could just disable/enable all Hotspots by using the Engine: Manage systems Action to set the state of the Interaction system.
  • Thanks I managed to work it out.

    My custom script is in my Assets\CustomScripts folder
    As for the error message, this is what I get:

    Instance of InspectRotate couldn't be created. The the script class needs to derive from ScriptableObject.
    UnityEngine.ScriptableObject:CreateInstance(String)
    AC.AdventureCreator:RefreshActions() (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:428)
    AC.AdventureCreator:OnEnable() (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:47)


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.