Mesh shape from node vs from spatial

Hello, does anyone know the difference between these two lines of code?

  CollisionShape terrainShape = CollisionShapeFactory.createMeshShape((Node) terrain);

vs

  CollisionShape terrainShape = CollisionShapeFactory.createMeshShape(terrain);

From my tests, they’ve both worked the same so I guess there is a deeper difference. Thanks :slight_smile:

One has an unnecessary cast and the other doesn’t.

createMeshShape() only takes a spatial so casting to Node does absolutely nothing except make the compiler work slightly harder maybe.

Edit: oh, and the first one will throw an exception if terrain is not a Node… but they are literally calling the exact same method, passing the exact same reference, otherwise.

I see. Thank you. You might want to get rid of it in the tutorial, in that case, it might confuse people ^^