This package allows you to configure Activities for your game through events instead of writing code.
It comes with 3 examples: Activity Interact, Activity Collide, and Activity Trigger which send Activity events for OnInteract, OnCollision, and OnTriggerEnter events respectively.
- Install the Simple Activities package from the community tab.
- Add the Activity Controller template somewhere in your world.
- Create a new Activity in your game and change the “Event” property to something unique.
- Add the activitySpecScript to the object you’d like to interact/collide with, or a trigger you’d like to enter.
- Set the “activityEvent” property to match the “Event” property on the Activity you created.
- Check your Activity by viewing the Activities tab in the console and interacting/colliding/entering the object/mesh you set up.
- The collision detection in Crayta may fire multiple times per frame and this package doesn’t provide a stop for that.
- This package could be extended for use with any event as long as pass the
playeras the first argument and the
activityEventas the second argument.
- You can leverage the Activity Controller from any script where you have a reference to the player like so:
GetWorld():FindAllScripts("activityControllerScript"):GetEntity():SendToScripts("SendActivity", player:GetUser(), "eventName")where “player” is your player reference and “eventName” matches the Event property on your Activity.
For help with this package reach out to me, ekelrock, on the official Crayta Discord.