Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi, I have a scene node that is random patroling. I want to click on it and change it's position. The problem is that when the position is changed, I want to stop the scene node from random patroling (just stand in this new position). How can this be done? Thank you in advance Bogo |
||||
|
You can execute javascript command ccbAicommand to stop the scene node from random patroling... |
||||
|
Hi just_in_case, thank you for your reply. I tried to do what you wrote, but for me it doesn't work. I ran the following javascript code in the "when clicked on this do something": var s = ccbGetSceneNodeFromName('myNode'); I don't know where am I wrong... the code does absolutely nothing (it doesn't generate any error, but at the same time it does nothing at all). The node continues his random patroling without stopping or changing it's position. |
||||
|
nobody can help me? |
||||
|
From what I understand, you want it to move only once, randomly, right? I think it would be easier just to set the node not to move, and move it once to a random position with such a command. Like with: var s = ccbGetSceneNodeFromName('myNode'); Woudln't that work for you? |
||||
|
Thanks Niko for your reply. I'm sorry but I need the node to randomly patrol in the beginning, then after a click the node will move to the new position and finally when the node reaches the new position, it stops in the new position. Is it possible? |
||||
|
Ah, I see.. no, I don't think that's possible right now, unless you modify the code a bit. Probably easier to send your enemy to some random positions manually until your 'stop' event triggers. |
||||
|
Thank you Niko I'll try to find a work-around. |
||||
|
I haven't found any solution... Can someone please help? Any script or behaviour for this? |
||||
|
So figure what position the scene node will end up where you want it to stand still.. make a clone of that scene node so when the first clone arrives at that position, delete first clone and appear the 2nd clone so it looks like it was the same scene node if this make a since.. I've done it that way many times if I can't get something to work right. |
||||
|
Nice crackyourspeaker, it's a good workaround, however, I have really a lot of scene nodes, and this solution is good if there are few. Another problem is that the final position of the scene node it's not always the same, I would like to be able to change it often without too much trouble for each node scene. Is it possible to find a better way, maybe more dynamic? Modify a little bit the "random patroling" code someway? If someone could help, I would really appreciate a lot. |
||||
|
I think what crackyourspeaker has said is fine just get the last position and remove the source old node and clone it again in the already saved position not sure what do you mean by a lot of objects will the character in patrol action collide with these objects ? |
|