Hi.
'Mouse Pick Event' Should work.
but if you have many objects i would use a different approach.
Many listeners (mouse over/ mouse pick events) would not be so good for performance.
a better way would be :
a fsm doing mouse pick every frame and store game object.
Then another fsm and use 'Fsm Game Object Changed' (Ecosystem)
When changed, check gameobject in an array and get the index.
Then have a 2nd array with the "Press 'E' to get more info" objects.
And with the index you got from the 1st array you can now get the object that you should activate.
Another way, IF the "Press 'E' to get more info", is the same on each object, you could also get the game object position.
and move the "Press 'E' to get more info" to the game object.
Then you can also check if no gameobject by using "Game Object Is Null" and if null disable the "Press 'E' to get more info"
To get the 'Educational Text' you could also use the index and have an array with them.
Have another fsm with a state with get key down and have a global transition to it (enabled)
also have a another state state and have nothing in it, also add a global transition (disabled)
on state after get key down use get fsm int, to get the index....
Scratch the above, just get the attachment below, you can find a sample scene in it and some custom actions from the ecosystem that where needed for the sample.
its easier to understand if you see.
if you have difficulties to understand, let me know and i will make a video on it
Hi,
Thank you very much for the help.
I am also sending you a sample scene
Maybe it makes things easier
..So I imported your Scene with the 'Mouse Pick Handler'. I have a 'Mouse Pick Handler' object now in my Scene.
What I'm confused about, is how does the 'Mouse Pick Handler' link to specific objects in the scene that are supposed to release the 'Press E to get more information' and display of Educational Text.
I tried to figure it out in your sample scene. How is it linked to the 3 cubes exactly?
When I originally did it with 'Mouse Over', (it's in my attached sample scene as well) the FSM was on a collider, so I could place that collider wherever in the scene, where it's supposed to release an educational text when standing close to it.
With the 'Mouse Pick Handler' I have in my scene now, it just detects all objects that have a collider in the scene I think. So not specific spots.
It also does not display the UI Educational Text for some reason.
I need basically three different mouse over actions:
- One that releases Educational Texts
- One for picking up objects
- One for starting a dialogue system with NPC's.
I created three different UI Text objects for that. It's in my sample scene.
I also left the 'Picking up Object on Mouseover and clicking 'E' object, and the 'Object releasing Educational Text on Mouse over' object. Those work, they just have that distance issue I mentioned earlier.
The new Mouse Pick Handler is also in there.
Would I need three different Mouse Pick Handlers in my scene? One for dialogues, one for picking up objects and one for educational texts?
A video would definitely help a lot, or explaining why this scene I am sending you doesn't work. Thank you so much for your time and thanks for your patience on my newbie questions
Sample Scene, download-link:
https://we.tl/t-rR31Rnr4Kd