[Q] 2. Child Camera with loaded Meshes
-
- Posts: 18
- Joined: Mon Aug 27, 2007 5:40 am
- Location: Vienna, Austria
[Q] 2. Child Camera with loaded Meshes
Hi there,
i have a question... i made a hud with tutorial 6 (2d) so far so good... now i want a weapon too, but not as a pic (.bmp/2d hud)! i want to load a weapon model...
Well i read some threads and found out that this is possible with a
"second (i m using a FPS camera) child camera with a loded mesh"...?
Well... i ve never coded child stuff (dunno what this means)... could u help
me?
i have a question... i made a hud with tutorial 6 (2d) so far so good... now i want a weapon too, but not as a pic (.bmp/2d hud)! i want to load a weapon model...
Well i read some threads and found out that this is possible with a
"second (i m using a FPS camera) child camera with a loded mesh"...?
Well... i ve never coded child stuff (dunno what this means)... could u help
me?
Nope.
-
- Posts: 368
- Joined: Tue Aug 21, 2007 1:43 am
- Location: The Middle of Nowhere
This should be fairly easy, and irrlicht makes adding nodes to others as children very simple.
What you need to do is create a pointer to your camera, then load your model, and set it's parent to the camera.
Here's some sudo-code
Then just add a texture and treat the node as normal.
What you need to do is create a pointer to your camera, then load your model, and set it's parent to the camera.
Here's some sudo-code
Code: Select all
scene::ICameraSceneNode* camera = smgr->getActiveCamera();
IAnimatedMesh* mesh = smgr->getMesh("Filenameofmesh");
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh->getMesh(0),camera <--This is the parent);
-
- Posts: 18
- Joined: Mon Aug 27, 2007 5:40 am
- Location: Vienna, Austria
So if i understand right...
this is my parent-cam (my main FPS cam):
and i need to make a child cam with ur code:
is this correct?
if yeah, there comes an error...
it says that it cant convert parameter 1 (imesh) to parameter 2
(animatedmesh) or something like this... it occures in this line:
"smgr->addAnimatedMeshSceneNode(mesh->getMesh(0),camera);"
greetz, hope 4 help
this is my parent-cam (my main FPS cam):
Code: Select all
scene::ICameraSceneNode* camera;
camera = smgr->addCameraSceneNodeFPS(0, 100.0f, 280, -1, keyMap, 9, false, 0.35);
camera->setPosition(core::vector3df(-100,50,-150));
Code: Select all
camera = smgr->getActiveCamera();
IAnimatedMesh* mesh = smgr->getMesh("Filenameofmesh");
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh->getMesh(0),camera);
if yeah, there comes an error...
it says that it cant convert parameter 1 (imesh) to parameter 2
(animatedmesh) or something like this... it occures in this line:
"smgr->addAnimatedMeshSceneNode(mesh->getMesh(0),camera);"
greetz, hope 4 help
Nope.
-
- Posts: 18
- Joined: Mon Aug 27, 2007 5:40 am
- Location: Vienna, Austria
u mean:
??
Code: Select all
camera = smgr->getActiveCamera();
IAnimatedMesh* mesh;
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode("PathofModel" ,camera);
Nope.
-
- Posts: 18
- Joined: Mon Aug 27, 2007 5:40 am
- Location: Vienna, Austria
-
- Posts: 18
- Joined: Mon Aug 27, 2007 5:40 am
- Location: Vienna, Austria
can i fix it with this lines:
?
Code: Select all
node->setPosition(vector3df(0, 0, 0));
node->setScale(vector3df(1, 1, 1));
Nope.
-
- Posts: 18
- Joined: Mon Aug 27, 2007 5:40 am
- Location: Vienna, Austria
Yea i know that i need to change the values first but are the commands right:
i mean setposition and setscanle x_x'
greetz
Code: Select all
node->setPosition(vector3df(x, x, x));
node->setScale(vector3df(x, x, x));
greetz
Nope.