1'st player camera collision.

Maklaud

09-01-2007 19:48:40

Hi!! I need my camera collide with all objects in my scene. Bun I can't do it :( I saw this topic:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2110
And I use Dragon's code. But it dosen't work correctly... My camera stay in one point and I can't move it. I can't understand, where the problem is.
I create files FPPCamers.h and *.cpp like in this topic. But I use ExampleApplication and ExampleFrameListener. This code I put into createScene in my application-class:

//add my camera and apply material pair with floor
FPPcamera = new FPPCamera(mSceneMgr,m_World,mCamera);

OgreNewt::MaterialPair* material_pair2 = new OgreNewt::MaterialPair( m_World, FPPcamera->FPPmat, floormat );

material_pair2->setDefaultFriction(0.0f, 0.0f);
material_pair2->setDefaultSoftness(1);
material_pair2->setDefaultElasticity(0);
material_pair2->setContinuousCollisionMode(0);

Other code below this part (keyReleased, keyPressed and so on) I put in my FrameListener-class.

Can anybody help my with my problem? :cry:

Maklaud

10-01-2007 12:46:05

Is there anybody, who can help me?? I need it very much. Please!!! :cry:

LuRenJia

10-01-2007 14:29:28

maybe you should register a FrameListener, such as Newton_FrameStart callback.

Maklaud

11-01-2007 05:26:01

Hmmm.. I'm sorry, but I'm just a beginner and I don't understand you :( I regester my FrameListener and there is callback-function in it...

Maklaud

12-01-2007 16:05:09

I think I know where is the problem. I put this code into camera_force_callback-function:

FILE * f;
f = fopen("./Text1.txt", "w");
fprintf(f, "%s", "Yes");
fclose(f);
[*code]
When I run the application and quit it there is no any files. Cunclusion - function dosen't called. Am I right? What may I do? I need camera collision very much!!

Maklaud

15-01-2007 17:47:42

Hi again ;) I did my callback-function, it works correctly. BUT!! I can't move my person rightly. I don't understand forses, velosity, quaternions etc. Can anybody help me and give me good sources code for this?? I need code inside keyPressed and callback-function - all for moving my camera. Help me please!