1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
class Camera_Ray
{
public:
core::line3d<f32> line;
core::vector3df intersection;
core::triangle3df hitTriangle;
scene::ISceneManager* mgr;
scene::ISceneNode* selectedSceneNode;
scene::ICameraSceneNode* camera;
scene::ISceneCollisionManager* collMan;
void setup(scene::ISceneManager* mgr, scene::ISceneCollisionManager* cMan, scene::ICameraSceneNode* cam)
{
collMan=cMan;
camera=cam;
}
void update(f32 frameDeltaTime, core::vector3df relative_line_end, core::vector3df desired_position)
{
line.start = desired_position;
line.end = desired_position + relative_line_end;
selectedSceneNode = collMan->getSceneNodeAndCollisionPointFromRay(line,intersection,hitTriangle,ID_Collide,0); //<-- debugger points to this line
}
}
struct arm {
core::vector3df position;
Camera_Ray ray;
};
arm rightarm, leftarm;
void setup_arm(arm &which_arm)
{
which_arm.ray.setup(mgr,collMan,camera);
}
Camera_Ray temp_ray;
setup_arm(rightarm);
temp_ray.setup(mgr,collMan,camera);
temp_ray.update(frameDeltaTime, core::vector3df(10,0,0), desired_position); // <--- this bit works fine
rightarm.ray.update(frameDeltaTime, relativeTarget, desired_position); // <--- this causes a crash
|