Avatar help->attach to camera

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Avatar help->attach to camera

Post by MikeR »

I'm using code to attach a weapon to the camera, tweaked to make it an avatar instead, but my avatar isn't loading.
The code is:

Code: Select all

//avatar test
 // need to add a camera and name it camera to use it to 
   // attach the weapon to it for movement 
   scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0,100.0f,300.0f); 

   // lets place an avatar in the scene 
   scene::IAnimatedMesh* avMesh = smgr->getMesh("media/defaultblueguy.dmf"); 

   // Create a node so we can attach the avatar to the camera 
   scene::IAnimatedMeshSceneNode* avNode = smgr->addAnimatedMeshSceneNode( avMesh, camera, 

-1 ); 

   // Your animation speed may be different so play with the value 
  // avNode->setAnimationSpeed(20); 

   // The next few lines are the ones that have to be hand 
   // tweaked and you may not at first see your avatar. 
   // The values below reflect my avatar setting to see 
   // it in front of me.
   avNode->setScale(core::vector3df(6,6,6)); 
   avNode->setPosition(core::vector3df(0,340,50)); 
   avNode->setRotation(core::vector3df(0,-95,0)); 

   // The final setup putting the camera in the level 
   // where it best suits the start of gameplay. 
   camera->setPosition(core::vector3df(0,350,50)); 
   camera->setRotation(core::vector3df(0,-95,0));
//Add collision responce to the camera
	scene::ISceneNodeAnimator* anim =    smgr->createCollisionResponseAnimator(
		selector, camera, core::vector3df(30,50,30),
		core::vector3df(0,-3,0),
		core::vector3df(0,50,0));
	camera->addAnimator(anim);
	anim->drop();
	
	// disable mouse cursor

	device->getCursorControl()->setVisible(false);
	
I am using the code posted by Rat here:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1630
The scene is still rendering fine.
Camera is working as expected with collide and gravity.
No avatar.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

would'nt a child of the camera move with the camera?
the word 'avatar' confuses me
i saw the screenshots of ur world / user interfacing project and imagine like a small animated creture as compagnion for the user as he move through the interface.
is that asumption correct?

-at least ur post was bumped up ;)
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Squad

Post by Squad »

So he wants a gun to move like in a FPS with his camera? Sounds like bearSoft has the idea because if you child it then it would follow it so it would always be there should try that to see if it works.



bearSoft I love your small print :wink:
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

An avatar is just a mesh that looks kinda like a person to represent you in a virtual world.
I've been looking at adding the av as a child node.
Coding is such a headache. I love your fine print too
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
r3i
Posts: 147
Joined: Wed Jun 29, 2005 10:15 am
Location: Sorrento
Contact:

searching in the forum

Post by r3i »

Hi Mike,
i think that you must consider your avatar like a personalized curso for your mouse with traslated coordinates: watch here and in the forum "How to"
you can find 1000 topic explaning perfectly the procedures.

^.^ see ou soon
"We work in the dark, we do what we can, we give what we have, Our doubt is our passion and our passion is our task. The rest: is art of Madness" (H.James)
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

Thanks. I added my av as a child node of the camera and it worked perfectly.
I did a search the other day and downloaded several examples of making the camera a child of the av and will try those soon.
Thanks for all the help. :)
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
Post Reply