Moving a body relative to camera

Eldritch

21-04-2007 20:26:01

I am thinking about doing a control system for one of my Newton bodies that is similar to Mario 64/Rogue Trooper/Tomp Raider where the body moves relative to how the camera is looking.

For example, if I want to move it forwards, it moves in the direction the camera is looking. If I want to move it to the right, it will move -90 degrees from the direction the camera is looking.

Would this be possible using Newton forces to move the body?

Acid_Gambit

22-04-2007 02:25:42

You mean like a 3rd person camera system? I believe there's a code snippet on the wiki. It's not Newton (or OgreNewt for that matter) but it should give a clear idea of how to proceed from there. I used that code in my project and translated it to work with Newton forces rather than ogre movement.

Eldritch

22-04-2007 07:21:55

I don't know of the wiki tutorial for the third person camera is what I am looking for since there is no demo link (at least not what I can see).

Acid_Gambit

22-04-2007 10:22:14

Here's the link: http://www.ogre3d.org/wiki/index.php/3r ... m_tutorial

It's very easy to implement. All you have to do to make it work with ogrenewt is modify the OgreCharacter class (add ogrenewt bodies and custom force callbacks). The camera has no collision though so you'll definitely have to dig into it but it can be done. And even though it is not the easiest way to approach a camera system I like it far more than a standard 1st person view.