First Person Camera in MogreNewt

Loading

07-12-2006 19:00:45

Hi. I need some help making a first person camera that responds to collision in Mogre and MogreNewt. How can I accomlish this?

btw, I'm using Mogre in C# and have tried converting C++ examples to C#, with failure.

:D Thanks

Bekas

08-12-2006 01:36:35

It's more likely to get some help if you make a more specific question, i.e. "Here's a small c++ class, I'm trying to convert it like this but it's not working, it doesn't compile/throws this exception/causes the monitor to explode, what's wrong ?" etc.

Loading

08-12-2006 01:50:34

ok, well this is the code that I found in C++ do make an fps camera:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2110.
I have converted every line to what the C# equivelent would be. I get a nullreference at this peice of code:

OgreNewt.BasicRaycast cam_ray = new BasicRaycast(mWorld,get_body_position(cam_bod), get_body_position(cam_bod) + Vector3.NEGATIVE_UNIT_Y * 2000 ); // throw a ray from the body to 2000 units below to calculate the // height of the body regard to the floor.

if (cam_ray.getHitCount() > 0)
{
cam_height = cam_ray.getFirstHit().mDistance*10000; // calculale the camera height.
}


More specifically at this line:

if (cam_ray.getHitCount() > 0)


Does anyone know why I might be getting this exception OR if you know any way to make a first person camera in MOgreNewt. I'm sure this would not only help me but many people who have found there to be very little Mogre and MogreNewt tutorials and articles.
Any help is welcome :D :D



oh and i have another problem. this causes my monitor to go all twitchy, get hot, and rupture.. :twisted: :twisted:

Bekas

08-12-2006 11:34:57

That's an embarrassing bug, good catch!
Get the new binaries from here: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2984

Loading

08-12-2006 20:20:10

nice! Thanks for fixing that. I honestly thought that it was my fault and I was doing something wrong. lol

thanks! :D :D :D

RichTufty

09-03-2007 11:32:14

ARGH! Thought i was doing something wrong too! This has been driving me up the wall! Phew, glad it has been fixed! Thanks!

mutambo

13-04-2007 16:07:20

Hello Loading,

I tried the same thing you did. I have converted every line to what the C# equivelent would be from that link, but it is not working. Couldn't you share your code of first person camera detection please.

Thanks a lot.

andyhebear1

31-05-2010 16:14:09

good work