0

I have a point:

point: n
x: 1250625.1650299462
y: -5015983.5669022305
z: 3730748.0432948116

And I'm trying to create a Cartesian3 instance from

point = new Cesium.Cartesian3(point.x, point.y, point.z)

But that is not right since I can't access the add method of Cartesian3... where randomOffset is also suppose to be a new Cesium.Cartesian3 instance, but I'm only getting a 'n' result object from 'new Cesium.Cartesian3'.

     point = point.add(randomOffset)

What am I doing wrong here?

bcm
  • 5,470
  • 10
  • 59
  • 92
  • I noticed this add method is marked ... what does this mean and can I still use it? – bcm Mar 10 '14 at 06:23

1 Answers1

0

I got it.. this is incredibly silly question!

Static means I just access it directly from

Cesium.Cartesian3.add(first_cartesian3, second_cartesian3)

Without using it from the instance.

bcm
  • 5,470
  • 10
  • 59
  • 92
  • Correct, but you should use the optional `result` parameter if this code lives inside the render loop. You don't want the add function to be creating new Cartesian3s every animation frame, or the garbage collector will make your animation jerky. Instead, allocate a scratch Cartesian3 in your init code, and use it as the 3rd parameter of this function each frame. You can use Chrome Devtools to profile memory usage during animation. – emackey Mar 18 '14 at 13:14