How to bind a weapon before camera
How to bind a weapon before camera
just like counter-strike and half life,bind a weapon in front of the screen.
Search the forum if you've got a question because most of your questions will have been answered before.
Basically just use this:
gun_node->setParent(camera_node);
gun_node->setPosition(vec);
where vec is a position RELATIVE to the camera's position which will align it nicely to be on screen, this is just something you have to find with trial and error based on the gun model you're using.
Basically just use this:
gun_node->setParent(camera_node);
gun_node->setPosition(vec);
where vec is a position RELATIVE to the camera's position which will align it nicely to be on screen, this is just something you have to find with trial and error based on the gun model you're using.
It's not really a difficult challenge to work out how to get it to stay there. If you have the cameras current direction, you can point the gun in that direction at all times. Then, using the cameras current position and rotation, you can work out exactly where the gun needs to go. It's the kind of thing you just need to sit down and work out.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Yes, since scene node rotations and camera targets are independent. However, it's probably a safe assumption that this poster is using an FPS camera.Eigen wrote:But wasn't it that unless you use the default FPS camera, the gun wont rotate along with the camera and you have to do it manually?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way