Interact With Meshes

Hopefully this will help new member of the community or those who require lots of tweakable options for their meshes. There is one main new script that provides 80% of the functionality, but there are some of the base Crayta packages that get pulled in.

Installing

Go to the community tab and search “Interact With Meshes”.
Install the package
Drag interactiveMeshScript onto any mesh you want.
Change the properties to the ones you want to use.
Ideally, make this mesh into a template.

To use Notifications/Shouts functionality:

Go to the community tab and search “Notifications”.
Install the package
Drag userNotifications on User Entity.

To use Pickup functionality:

Go to the community tab and search “Inventory”.
Install the package
Drag UserInventory on User Entity
Drag PlayerInventoryView on Player Entity
Drag pickupSpawnerScript and inventoryItemSpec script need to go on the mesh/template Entity.

To use Prompts functionality:
Go to the community tab and search “Prompts”.
Install the package
Drag UserPromptsView on User Entity

Additional:
I recommend using the Briefcase/Vending Machine templates to get a better idea of the setup. You can use the InteractivePromptsHelper on meshes that you don’t want to pickup but need prompts to display.

Properties

There are lots of properties that can be tweaked for the mesh interactions itself:

canToggle = Should we be able to toggle this on/off or is it a one shot.
useAnimations = Use animations that are on this mesh.
playAnimationOnClient = Play on client only.
startingAnimation = Animation to play when this spawns.
delayStartingAnimation = Delay starting animation.
loopStarting = Loop starting animation.
interactingAnimation = Animation to play when interacting.
delayInteractingAnimation = Delay for interaction animation.
loopInteracting = Loop interacting animation.
endingAnimation = Animation to play when ending animation.
delayEndingAnimation = Delay for ending animation.
loopEnding = Loop ending animation.

sound = Sound to play when interacting.
soundLocator = Sound position based off a locator.
repeatSound = Repeat the sound when interacting.
repeatSoundAfter = How often to repeat the sound.

effect = Effect to play when interacting.
effectLocator = Effect position based off a locator.
repeatEffect = Repeat the effect when interacting.
repeatEffectAfter = How often to repeat the effect.

spawnedTemplate = What template to spawn.
spawnLocator = Spawn position based off a locator.
spawnedNumber = How many templates to spawn.
setVelocity = Vector, can set which directions to spawn templates in.
lifetime = How long a looping audio and effects should last. Leave on zero to constantly loop after interaction.

shout = What to shout (Requires Notifications to be installed.)
shoutTime = How long to shout for.
notification = What to notify players with (Requires Notifications to be installed.)

1 Like

WoW thanks… I.m going to test It! Looks great

I can see a few expansions to this already, but feedback may dictate what path that takes.

as soon as I get home from work I start playing with this new toy and I give you feedback

I can’t get how prompts work exactly. Could you clarify this, please?

From what I remember, the prompts are provided by the existing Crayta Prompts script. This will either work out the box with the existing pickup script that is also one of the Crayta base scripts, or you can use the interactivePromptHelper script I added to make it appear on non-pickup objects. All this does it allow you to add some generic description to the end of the prompt.

Example: If I have an air vent mesh I can attach the interactivePromptHelper and then add a prompt message: “access the air vent” in the game it will show something like “press E to access the air vent”.