Hey !
I’d like to find out which NodePath are between a given object and the camera.
I tried setting CollisionRays starting from the model’s node to the camera’s node, but the ray always end up far higher than the actual camera.
I tried something of the likes:
{
NodePath camera_node = GetCamera()->GetNodePath();
NodePath character_node = GetPlayer()->GetNodePath();
PT(CollisionRay) collision_ray;
PT(CollisionNode) collision_node;
NodePath collision_path;
collision_ray = new CollisionRay();
collision_node = new CollisionNode("");
collision_node->add_solid(collision_ray);
collision_path = window_framework->get_render().attach_new_node(collision_node);
collision_path.set_pos(character_node.get_pos());
collision_picker->set_origin(0, 0, 0);
collision_picker->set_direction(camera_node.get_pos());
collision_path.show();
}
I also tried setting the pos to 0,0,0 and the origin to the character_node’s position, but in this case I haven’t even been able to find where the ray ends up.
Is there a better solution for this problem ?