- Home /
What would you do with essential items?
I'm currently building a teambuilding game for VR, for a client. In the game the players will need to collect and bring along a few essential items with them. Some of the items will be able to be "equiped" to a players inventory, but some items will only be able to be held by the players and used in that location. The players will be on a linear path, high up on a mountain.
Now my dilema is I'm trying to think of a good way to be able to return "lost" items to the players. For example, in one part the players will need to fill a bucket with water. Imagine one of the players tosses the bucket over the ledge and down the mountain.
Here are my current solutions:
Have the object automatically teleport back to a certain position if an item is "lost".
Have the admin (who is running the server via a PC, and can interact with the game) manually move items
The issues are:
What kind of trigger should be used? Should I manually create trigger areas outside of the walking area that starts a "Teleport back" method, also where should the return point be? Say I use the last place the bucket had velocity 0, but that still might be outside of the players reach
If the admin can't physically see the item, it might be hard to get back
I'm thinking the admin might need an on screen list of items that can be "reset" if need be, or even manually moved.
Any other ideas from this creative community?
Answer by Kona · Sep 01, 2021 at 09:25 PM
Personally, I'ld go for the first option. If it could happen' several times it could become irritating for the admin to constantly reset the item. :)
If your game takes place on a mountain and the most common case of losing an item would be to drop it over a ledge you could make the game master ( or equivalent ) hold a property of lowest-allowed position along the y-axis for items before beeing reset. This would need you to ensure that all non-reachable locations are deep enough though, but you won't have to create triggers everywhere on the other hand.
Then at regular intervals compare the y-position of the item and the lowest-reachable-point to see if the item is to be reset or not.
As for teleporting the item. An idea would be to have multiple "checkpoints" or "item-respawn-platform-thingies" and when the item is reset simply check distance to each item respawner and place the item at the nearest one.
Otherwise I'ld suggest raycasts. While the item is beeing carried you could cast a raycast downward once every 2-3 seconds and determine if there's a reachable surface beneath it. This could require setting up some tags though for surfaces that are reachable or not reachable, then comparing the object hit with the raycast if it's tag matches, and if so caching the hit point as "last safe point" or something for later reference.
//Edit Now when I think about it... if you would perform raycasts at regular intervals while carrying the object, it should probably work just as well for detecting if the object enter a non-reachable area- either due to a lack of colliders or if the collider is tagged as not-reachable
I ended up creating a custom script so the ad$$anonymous$$ can easily reset the object to the mouseToWorld
position and simple toggles showing an outline of the object through walls too :)
Great idea with the raycasts, I'll have a look at that solution in the future when adding quality of life updates!
Your answer
Follow this Question
Related Questions
How to pick up objects 1 Answer
A transform.position to act as a Vector3 1 Answer
about loop transforming objects 1 Answer
My script doesnt respond what i wrote HELP!!! 0 Answers
Navmesh agent problem 1 Answer