Forums › š¬ NodeCanvas › āļø 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.
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!
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.
<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>
