collision spherical x ellipsoid

Started by Thomas., December 31, 2010, 10:56:49 PM

Previous topic - Next topic

Thomas.

Why is ellipsoid camera collision so slow? I tried checkCameraCollisionSpherical and game is running stable 54-55 fps but if I use checkCameraCollisionEllipsoid frames drops to 17 fps

EgonOlsen

Simply because it's much more demanding. You can play around with the recursion depth to tweak it a little bit.

Thomas.

it is extremly demanding, I have same result with number 1 or 5 on recursion depth... and collide offset is sets to 40

EgonOlsen

#3
Well...yes. It's much heavier on the fpu (or its emulation on older devices), because it has to transform vertices of objects in question into ellipsoid space, which can be expensive on Android. What's the exact scenario in which you are using this? If it's a rather complex and huge mesh (like a level), you might want to try to use an octree for collision detection. Or you can use a alternative, simpler mesh for collision than for rendering. To do this, simply make the simple one visible and hide the complex one, do the detection and reverse the process again for rendering.

Thomas.

I see... I am doing first person shooter game... the "main" object has not so much polygons, but almost every object in level has about 500 polygons and those are a lot of... I will try to do another system for check player collision ...

EgonOlsen

Polygon count matters only if an object is the way of the translation of the ellipsoid. Everything else will be discarded pretty quickly by a bounding box check.

Thomas.

Thanks for explanations :) ... I want to do everything the most modifiable, so alternative simpler mesh can not be and check collision spherical is doing issue...

Thomas.

My game is much more complicated now and I want to use alternative objects for collision... but when I use obj.setVisibility(false) object is not visible, but also is not calculated for collision... how can I set object just for collision? and why jPCT-AE is not supporting for portals?

EgonOlsen

You have to toggle the objects, i.e. make the collision objects visible, do the detection, make them invisible again. Or use another world that only stores the collision meshes.

Thomas.

#9
thanks, what will be faster world or toggle? or it is same?
PS: I have tested toggle now, but this collision running in another thread and object is blinking

EgonOlsen

Then either opt for an additional world, sync the rendering with the collision detection or don't do it in multiple threads. Doing this in multiple threads is asking for trouble anyway IMHO. I wouldn't recommend it.

Thomas.

this collision is from touch event thread

Kaiidyn

the touch event itself is also pretty demanding,
I dont know if you have already done so, but adding a Thread.sleep(25); to the touch method might help a little bit..
Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer's intent but rather is full of crisp abstractions and straightforward lines of control. - Grady Booch

EgonOlsen

#13
Quote from: Thomas. on April 12, 2011, 12:08:42 AM
this collision is from touch event thread
Don't do this...doing the collision detection and especially transformations in parallel to the rendering thread is asking for trouble. I quote myself: http://www.jpct.net/forum2/index.php/topic,1994.msg14695.html#msg14695 and http://www.jpct.net/wiki/index.php/Multithreading#Thread_safety

Thomas.

#14
Are possible to do some objects for collision by player "body", some objects for shoot, some for enemies,... ?
PS: solved