Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Access Clones

onceforloops3
Registered User
Quote
2022-11-27 00:01:36

How would I move a player camera object's position to new clones of an instantiated node? How would I write that in JS???

Perhaps something Like ccbAICommand "moveto" this.clone.position?

I have a set of cloned scene nodes and I want to be able to move the player camera to the next closest node in a set of clones based on "WASD" input.
Please Help
Thanks in Advance


onceforloops3
Registered User
Quote
2022-11-27 00:10:15

NM, I think I figured something out that will work. Just working still on my big planets for my game. Too many distractions where I am living. LOL


sulbcon
Registered User
Quote
2022-11-27 23:11:16

The best way is this... To be able to access the clones of the node, create a base node then add 1 to the name (e.g "fire1") then to get the clones of the same node, just use a loop and then keep adding to the number to the base name i.e "fire" + 45
Something like this...

var loop =1;
while (loop <= no_of_clones){
var node = ccbGet SceneNodeFromName("fire" + loop);
loop++;
}



onceforloops3
Registered User
Quote
2022-11-28 19:00:27

When some uses the "Instantiate" Javascript command, is that the same as using ccbclonescenenode or is it something different? I have a group of nodes that were created with the instantiate command, but I don't know how to get the camera to move towards the next node based on player WASD input.
I'm guessing I'll need to use an array, but I wouldn't know how to put one together by myself.


sulbcon
Registered User
Quote
2022-11-28 19:51:28

I have never used the instantiate command... So I advice you to use the clone command instead...
And to create an array, in the loop... Let it append each object to an earlier created array... e.g

var clones ={};
var loop =1;
while (loop <= no_of_clones){
var node = ccbGet SceneNodeFromName("fire" + loop);
clones[clones.length]=node;
loop++;
}



sulbcon
Registered User
Quote
2022-11-28 19:55:52

Then you can use the array to calculate the next node for the camera to move to.
(I actually think it would be base on distance


onceforloops3
Registered User
Quote
2022-11-29 22:21:51

As I mentioned I have never put together or could in the past put together an array. Sorry bro, I'm just more of a complete non-coder:( :)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (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