Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Help connecting the dots.

qtowndiver
Registered User
Quote
2013-01-12 04:27:02

can't figure out how to implement this :

var billboard1 = new CL3D.BillboardSceneNode();

billboard.Pos.X = x[i];
billboard.Pos.Y = y[i];
billboard.Pos.Z = z[i];

var billboard2 = new CL3D.BillboardSceneNode();

billboard.Pos.X = x[i+1];
billboard.Pos.Y = y[i+1];
billboard.Pos.Z = z[i+1];

var section0SceneNode = scene.getSceneNodeFromName('section0');

section0SceneNode.Pos.X = x[i];
section0SceneNode.Pos.Y = y[i];
section0SceneNode.Pos.Z = z[i];

'section0' is a cylinder created in CopperCube and i want it to be rotated so that it "connects" the dots between the 2 billboards.

i want to purchase CopperCube, but need to know how to make this happen before investing. Thanks in advance and thanks to all who answered all the questions from other people that also helped me so far.


niko
Moderator
Quote
2013-01-12 07:32:22

Not sure if this is exactly what you need, but you could try this: basically, you have two points, and want to get the rotation of a line between them, correct?
To make the code simpler, I'll name the first point p1 and the second one p2, and assume they are of type CL3D.Vect3d:

var lineVector = p2.substract(p1);
var rotation = lineVector.getHorizontalAngle();

// now set rotation:
section0.Rot = rotation;


It could be that you need to rotate the rotation by 90 degrees or similar, based on the model of your section0. Hope this is what you wanted :)


qtowndiver
Registered User
Quote
2013-01-13 03:03:31

Thank you very much Mr Nico for replying so quickly.. Worked just like you said it would and i am able to connect the dots as long as the dots are in the same horizontal plane. now to figure out how connect two points in two different planes. : )


Create reply:


Posted by: (you are not logged in)


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