Hello there
i recently started using irrlicht(.NET) and i saw the fps camera function which is very nice. but i want my camera to follow a character.
easy, i made a camera that just looks at the character.
good, now i just needed to learn how to rotate the camera and the object and to take input from keyboard.
the rotation of the camera and object is something i still didnt discover.
and the event that is suppoused to make something when S or W is pressed doesnt seem to work.
The best thing to do would be to control your character with the keys (when you get a WASD key event (or whatever your controls are) you move your character in the necessary direction) and then just get the camera to follow where the character goes so make it a child of the character node and give it a nice offset so you see the character from the perspective you desire and each frame you just set the camera's target to be the character's position (or could be an offset from the character's position if that wasn't desirable).
Camera's pretty much completely ignore setRotation() as you should use setTarget() to make the camera look at a certain position.
well i would make WASD move my character but i dont know how to make the event actually work, because it doesnt seem to do what i say when W or S is pressed.
and making sure the camera will always look at the object wont do. lets say i turn around the object but i dont change its xyz position. the object will turn but the camera wont and i aim that the camera will always look at the back of the object
Ok so you update the camera's position to always be behind the character based on the character's rotation using characterNode->getAbsoluteTransformation().rotateVect(cameraOffset)
What is your event receiver code for dealing with the WASD key presses?
Is that implemented within a class that inherits from IEventReceiver? It has to be. And the resulting class must then be registered with the device to the device knows where to send events to.
I created a topic sometime last week about modernizing an old third person camera code snippet which you might find helpful. Although its in C++ and not C# but you might be able to read it enough to make a port.