Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Change position of a scene node that is random patroling ..?

Bogo94
Guest
Quote
2016-12-12 09:36:55

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


just_in_case
Moderator
Quote
2016-12-12 16:50:47

You can execute javascript command ccbAicommand to stop the scene node from random patroling...


Bogo94
Guest
Quote
2016-12-14 08:52:43

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');
ccbAICommand(s, 'moveto', new vector3d(120, 0.1, -46.2));
ccbAICommand(s, 'cancel');

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.


Bogo94
Guest
Quote
2016-12-19 08:10:32

nobody can help me?


niko
Moderator
Quote
2016-12-19 08:30:32

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'); 
ccbAICommand(s, 'moveto', new vector3d(120, 0.1, -46.2));

Woudln't that work for you?


Bogo94
Guest
Quote
2016-12-19 08:40:01

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?


niko
Moderator
Quote
2016-12-19 13:40:47

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.


Bogo94
Guest
Quote
2016-12-19 14:19:41

Thank you Niko
I'll try to find a work-around.


Bogo94
Guest
Quote
2017-04-25 11:05:46

I haven't found any solution...
Can someone please help?
Any script or behaviour for this?


crackyourspeaker
Registered User
Quote
2017-04-25 12:26:24

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.


Bogo94
Guest
Quote
2017-04-27 19:48:01

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.


techno-valley
Registered User
Quote
2017-04-27 23:31:20

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 ?


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact