I’m kind of stuck on how the “node” parameter is working in a scriptObject.
Using node.scene, and node.parent are working as per my late post http://discourse.urho3d.io/t/angelscript-createscriptobject-and-external-class-solved/342/1, at least as long as it is in the update function.
If for example I call a function from update, like raycasting (using the example from navigation.as). If I have a function called raycast, this throws errors, null exception:
bool raycast(float maxDistance, Vector3& hitPos, Drawable@& hitDrawable){
hitDrawable = null;
IntVector2 pos = ui.cursorPosition;
Camera@ camera = node.scene.GetComponent("Camera");
Ray cameraRay = camera.GetScreenRay(float(pos.x) / graphics.width, float(pos.y) / graphics.height);
......
return false;
}
The GetComponent(“Camera”) doesnt actully return a camera.
also, as another example…
If I do what i am trying in a separate function in update, as long as I pass the uint id it works this way:
void Update(float timeStep){
Node@ cameraNode = node.scene.GetNode(_camera_id);
Camera@ camera = cameraNode.GetComponent("Camera");
....
}
but I dont pass the uint id and try to use a string like:
void Update(float timeStep){
Camera@ camera = node.scene.GetComponent("Camera");
....
}
It does not work, although I feel like I see this methodology used in the examples to grab static meshes and animated meshes etc… that is, not having to get the node before grabbing the component.
Just looking for some clarification on what I might be overlooking.
Thank you.