NodeCanvas Forums › Support › BT & trigger
<p class=”MsoNormal”><span lang=”EN-IE” style=”mso-ansi-language: EN-IE;”>Hello,</span></p>
<p class=”MsoNormal”><span lang=”EN-IE” style=”mso-ansi-language: EN-IE;”>I recently bought Node Canvas and I’ve being trying it out. <span style=”mso-spacerun: yes;”> </span>I’m quite new to scripting, FSM<span style=”mso-spacerun: yes;”> </span>& Behaviour<span style=”mso-spacerun: yes;”> </span>Trees. <span style=”mso-spacerun: yes;”> </span>I’ve consulted the manual but there are very few tutorials on how to get the best out of the asset. I’m using point and click movement with nav mesh agent on my player in BT – using the nodes that were on the examples download for FSM (Character point & click). However, I wanted to use check trigger – ‘if trigger enter’ with an enemy sphere but it doesn’t detect my player in the sphere collider.<span style=”mso-spacerun: yes;”> </span>Is this because I am using a nav mesh? <span style=”mso-spacerun: yes;”> </span></span></p>
eugene
Why won’t my point and click BT setup (as in the picture posted in the previous post) not register /recognise a trigger zone (sphere)? Thanks for your help.
eugene
Hello,
The trigger may work, but you have the condition at the end of the sequencer and as such even if it works, it does not really matter or do anything :). Usually, conditions are at the start of a sequencer (or other composite nodes). What is really the expected behaviour of your behaviour tree design here please?
There is also an example scene using Trigger condition in the downloadables example scenes. Please take a look at as well.
Let me know.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Thank you for your reply.
I looked at the examples before I posted as I downloaded the examples once I bought Node Canvas.
In one of the examples, (soldier chase) the player (sphere ) has a moveable script – point & click ( it’s not a BT as there is no blackboard attached). The soldiers chase depending on where I move the sphere.
So, I started out fresh, after reading your comments.
I only want to try ‘on trigger enter’ to start a new action. I have set up a player (capsule) and placed a BT bound with point and click movement. The player is tagged ‘Player’ in the inspector. The plane has a nav mesh and the player has a nav mesh agent and the point and click behavior works no problem when I hit play.
I then created a sphere with a sphere collider and ticked ‘is trigger’ in Unity’s inspector. I attached a BT (bound) to the sphere and created a condition – “If triggerEnter ‘Player’ Tag” followed by an action “debug log ‘received’ “. When I play and enter the sphere’s collider nothing happens – no debug log text ‘received’ and the condition remains red in the Sphere Behaviour tree.
I would like to have a point and click, where the player triggers events, open doors, start conversations. Thanks.
Why aren’t there any concrete tutorials on how to use node canvas? It’s a pity.
Hello and sorry for the late reply, but I was working full head on towards the new version 3 (which is actually just done!)
Can you please post a screenshot of your Behaviour Tree at the relevant nodes? Regarding the examples, I was refering to the “IfThenElse With Trigger” example scene, which uses a trigger pretty much this way, but please do post a screenshot of the BT so that I can help you.
Thank you!
Join us on Discord: https://discord.gg/97q2Rjh
Thank you for your reply. Yes, I imagine you must be very busy.
Yes, I saw the other example. And I can get a trigger response when using keyboard input like in the example. My problem seems to stem from using “mouse & point and click” and getting recognized when I point and click for the player on entering the trigger of the sphere.
I would like to set up a point and click adventure type game, so when I click the player into a trigger zone, something might happen …. but perhaps I’m doing it wrong!
Anyway, I have attached the screenshots of the simple behavior trees for the player & sphere and thanks again for the help.
(I also have Flow Canvas but I would prefer to use and learn Node Canvas FSM & BT as it seems easier to implement my ideas…but I know I have alot to learn!)
Hello again 🙂
Here are some things regarding your posted Behaviour Trees that I see could be wrong:
– In the Player BT, the Condition (“If Left Click”) seems to point to “Use Self”, which means that it expects to actually click on the player capsule. I presume you want to click on the plane though :). As such you will need to “override the agent” with the checkbox and assign the Plane Collider to the Condition Task.
– In the Sphere BT, I presume you want your “Start” node to be the Sequencer rather than the Condition (?). Also, for triggers to work in Unity, one of the two objects (Sphere or Player) needs to have a Rigidbody Component. You can add a Rigidbody component to the Player and set it’s “Is Kinematic” to false so that it does not actually have physics, but still works for triggers and collisions.
Let me know if the above helps you (or not) 🙂
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
<p class=”MsoNormal”><span lang=”EN-IE” style=”mso-ansi-language: EN-IE;”>Thank you for your reply.</span></p>
<p class=”MsoNormal”><span lang=”EN-IE” style=”mso-ansi-language: EN-IE;”>I added a rigid body on the player but without gravity nor kinematic and I added a nav mesh to the sphere and it seems to work. </span></p>
<p class=”MsoNormal”><span lang=”EN-IE” style=”mso-ansi-language: EN-IE;”>Best regards,</span></p>
<p class=”MsoNormal”><span lang=”EN-IE” style=”mso-ansi-language: EN-IE;”>Eugene </span></p>