Chaser camera and collision detection

I have loaded a quake level and added a chase camera.My third person object is a cube. I have added a collision detection to cube.When the cube hits on the wall of the quake level, I am able to handle collision.But the problem is when I camera hits on the wall, it falls through it.

I am using JME 2.0.How can I prevent this.Thanks in advance.

You can do ray casting in front of the camera that checks for wall collisions… or a simpler solution would be to put an invisible cube around the camera that operates the same way that your third-person character does…



Any particular reason you’re sticking with jME2?

Is there any example that achieving this ? The main reason I am still sticking to jme2 is that JME2 has got lot of examples and I think it is almost stable.There is a lot of experience using this framework.So that way to get a solution for any problem would be easier.Second reason is that my computer does not support jme3 beta. When I run some of the examples, I am getting a weird error " org.lwjgl.LWJGLException: Failed to find ARB pixel format 1 0". I am not able to fix this.I searched google , but could not find a proper solution to this.

Have you tried turning off anti-aliasing when running the jME3 examples?



jME3 frankly runs better and more stably than jME2. As far as examples go, the documentation is also far better for it, and its going to be tough finding people still using version 2.



With regards to the topic at hand, I don’t have any examples achieving this but it should be relatively simple. The same way you handle the collision of your cube, handle the collision of the cube around the camera and have it affect the camera’s position as well as the box.

How can I turn off Anti-Aliasing in jme3 SDK when I run jme3 examples? I am not able to find the optionfor that.I have one clarification here.I was able to run jme2 in my pc without any problem.can I use same system configuration for running jme3 examples as well? or should I upgrade it?


jME3 frankly runs better and more stably than jME2. As far as examples go, the documentation is also far better for it, and its going to be tough finding people still using version 2.

OK. Then I shall try to follow jme3 instead of 2.

With regards to the topic at hand, I don’t have any examples achieving this but it should be relatively simple. The same way you handle the collision of your cube, handle the collision of the cube around the camera and have it affect the camera’s position as well as the box.

In this case, the chase camera is always behind my cube.As I said, I am able to handle collision detection for cube.But when I move backward direction, the camera falls through the wall.So what I have understood for this solution is create a camera node with bounding box and use that camera node while creating a chaser camera.While moving backward direction, try to do collision detection with the camera node.Please correct me if I am wrong.
@gamerfan said:
How can I turn off Anti-Aliasing in jme3 SDK when I run jme3 examples? I am not able to find the optionfor that.I have one clarification here.I was able to run jme2 in my pc without any problem.can I use same system configuration for running jme3 examples as well? or should I upgrade it?


It depends on your configuration, specs would be useful. OpenGL 2 or greater is required.

As for the AA settings, its the menu highlighted in this image:



@gamerfan said:In this case, the chase camera is always behind my cube.As I said, I am able to handle collision detection for cube.But when I move backward direction, the camera falls through the wall.So what I have understood for this solution is create a camera node with bounding box and use that camera node while creating a chaser camera.While moving backward direction, try to do collision detection with the camera node.Please correct me if I am wrong.


That's where I would start, yeah.

I think I have OpenGL 2.0 in my pc.Let me try to run the examples with the setttings you mentioned.Right now I am away from my home pc. Shall update you later, however.

I changed the setting and I am getting this error.



com.jme3.renderer.RendererException: non-power-of-2 framebuffer textures are not supported by the video hardware.

How can I update the textures?

Its really time to post the specs of your graphics card :slight_smile:





Depending on which test you’re running you can look at the source code, see which image it is, and change the size texture in your working copy (presuming you’ve checked the sources out from SVN)


Its really time to post the specs of your graphics card


Please find the information below:

INFO: Running on: RDPDD
Driver version: 6.1.7600.16385
ATI Technologies Inc. - ATI Radeon X1200 - 2.0.6747 Release
processor:AMD Turion 64 X 2 Mobile technology
INFO: Caps: [FrameBuffer, FrameBufferMRT, OpenGL20, ARBprogram, GLSL100, GLSL110, TextureCompressionLATC]

That’s an integrated card, right? If you have a PCI-e slot on your motherboard then just about any graphics card you buy will be an upgrade from what’s in there… (just be careful of the power requirements of whatever you buy)


Depending on which test you’re running you can look at the source code, see which image it is, and change the size texture in your working copy (presuming you’ve checked the sources out from SVN)

actually , I have installed jme 3 beta sdk as exe from the site, not from SVN.I am getting the above error for almost all examples.

That’s an integrated card, right? If you have a PCI-e slot on your motherboard then just about any graphics card you buy will be an upgrade from what’s in there.. (just be careful of the power requirements of whatever you buy)

So, you are saying that I should buy a new graphic card?:D
Is there any problem with my graphic card?

one small clarification too.If I am manually updating the texture, where should I copy these files? I could not find the location where these textures are stored.Thanks for spending your valuable time.

@gamerfan said:
So, you are saying that I should buy a new graphic card?:D
Is there any problem with my graphic card?


Yes, it doesn't support non power of two (NPOT) textures. Many older cards don't.

@gamerfan said:
one small clarification too.If I am manually updating the texture, where should I copy these files? I could not find the location where these textures are stored.Thanks for spending your valuable time.


In this case you can stick the texture anywhere and update the path of the texture in whatever test you are running (if the texture is applied programatically), otherwise you'd have to check out the sources from SVN and update the textures in the src/test-data folder.

Yes, it doesn’t support non power of two (NPOT) textures. Many older cards don’t.

Is it? then, I am going to change the texture size to power of two and let me update it.

In this case you can stick the texture anywhere and update the path of the texture in whatever test you are running (if the texture is applied programatically), otherwise you’d have to check out the sources from SVN and update the textures in the src/test-data folder.

The examples I am running from jme 3 beta sdk editor. So already examples are there.I have not downloaded from SVN.So after making changes,I will be copying them to src/test-data folder and try my luck.

I have enabled collision detection with my third person controller camera using PickResults. This is the following code. I am checking collision detection from simple update.



[java]

private void calculateCameraCollision(){

Ray ray = new Ray(cam.getLocation(), cam.getDirection());

PickResults pr = new BoundingPickResults();

pr.clear();

pr.setCheckDistance(true);

levelModel.findPick(ray, pr);

// System.out.println("pr.getNumber():: "+pr.getNumber());

for (int i = 0; i < pr.getNumber(); i++) {

pr.getPickData(i).getTargetMesh().setDefaultColor(ColorRGBA.blue);

System.out.println(" len :: "+pr.getPickData(i).getDistance());

}

}

[/java]

But when I rotate camera along X-axis, the camera stills falls through my quake level walls.Please advice me how can I proceed further.Also please tell me what is the getDistance() method is trying to achieve.Thanks

@sbook, I was able to handle collision detection against the wall the way you had suggested. Attached a cube to camera node and whenever the camera moves, this cube also moves along with this.Still trying to implement a complete collision detection. Thanks for the idea.