Hello, I've been scanning the forums for the last few hours but I can't seem to find an answer for my problem.
Apparently, the FPS camera built into irrlicht is not good. Yes, I understand it is for demonstration purposes. There is bunnyhopping and you can jump while in the air which makes you fly indefinitely. And there are other issues too. I haven't found a single thread with a camera that actually works, responds to gravity and takes care of these issues.
Same applies to third person. There are some threads, but the code in them is not compatible with 1.6. Event receiver abstract class stuff and even when you make them work, they're not really that good. Some of them don't have strafing, and most of them need you to drag the mouse to turn around.
Am I missing something? Is there a good camera? If not, how can I implement a good FPS camera? I have no idea where to begin, how to check whether I'm on the ground (I tried casting a ray downwards but that's wonky) and deal with the collision animator's gravity while jumping.
Could someone either post a proper example or give me enough advice to make my own camera please? Third person isn't really an issue, it's just something I noticed, but the first person thing is really bugging me.
Cameras, first person or third person
-
- Posts: 277
- Joined: Thu Dec 15, 2005 6:11 pm
I recommend you code it yourself. You will need a little bit of trigonometry(or know how to use vectors) to calculate the movement. You set the rotation and position of the camera similar to other scene nodes, though rotation may or may not work depending some setting(don't remember which). On the other hand, you can use the lookAt vector to control rotation anyway.
On the other hand, you can duplicate the current FPS camera that you don't like, and "fix" it so you do like it. I think that may be more difficult though because it is done a certain way, and you may not want that for your game.
On the other hand, you can duplicate the current FPS camera that you don't like, and "fix" it so you do like it. I think that may be more difficult though because it is done a certain way, and you may not want that for your game.
The 3rd person camera (actually the 3rd marble camera) in my current project doesn't apply any movement. It just follows the object (the movement of which is calculated using ODE). But the mathematical stuff is in there, so you couls grab my project "marbles2" and take a look into the "CFollowMarbleCameraAnimator" (or something like this ... don't have the sourcecode here at work) for a 3rd person camera. The animator also moves the camera so that it will not get to a position where another object is between the camera and the followed object.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
I would use a physics engine for that. Or use the built-in collision system of Irrlicht. On the ODE wiki there is an article about using an "upright capsule" (with restricted rotation) for the player. I guess this can be done with Irrlicht collision detection as well.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames