Open GoogleCodeExporter opened 9 years ago
Another way to say it is... you can drop a smaller object through the inner
part of a large triangle in some directions in a Tri-Mesh.
Original comment by dcoliva...@gmail.com
on 15 Apr 2011 at 2:05
See attached picture.
Original comment by dcoliva...@gmail.com
on 15 Apr 2011 at 2:11
Attachments:
Thanks Dan, just building this in c++ bullet to test.
can you confirm the collision flags and masses that you have for for objects A
& B please?
Thanks
Original comment by xexu...@gmail.com
on 15 Apr 2011 at 1:52
A is the Pyramid. It's 0 mass. Static Rigid Body.
B is the cube. It's 1.25000083
Here's a video of the results.
http://www.youtube.com/watch?v=kAYcFdpVhIU
The collision flags are the default collision flags.
Original comment by dcoliva...@gmail.com
on 17 Apr 2011 at 7:00
Thanks . can you try with the updated MathUtil.cs
Original comment by xexu...@gmail.com
on 17 Apr 2011 at 9:14
I did update as requested. The following video demonstrates that it is not
currently resolved. http://www.youtube.com/watch?v=-HYoQN_t_WM
Again, the avatar is represented by a capsule.
Original comment by tera...@gmail.com
on 18 Apr 2011 at 12:14
Another video, this one, pretty close to succeeding...
http://www.youtube.com/watch?v=pX6yfQP9AhU
Original comment by dcoliva...@gmail.com
on 19 Apr 2011 at 8:14
http://www.youtube.com/watch?v=bdZF1el3ttM , This tube was unstable, but
successful
Original comment by dcoliva...@gmail.com
on 19 Apr 2011 at 8:14
Thanks. still looking at it, spent a while last night trying to narrow down the
conditions. First fix for MathUtil seemed to resolve the issue when the initial
pyramid was yawed 180 deg. current situation is pitched down 90 deg (falling
and colliding on the square base of the pyramid). I need to try it with some
other collision shapes to try isolate issues. Can be fairly painful debugging
this as the c++ floats and c# ones are always 'slightly' different so a lot of
noise to check through.
Original comment by xexu...@gmail.com
on 19 Apr 2011 at 8:18
Here's a successful video of a (SphereShape)sphere going down the inside of a
set of hollowed out (TriangleMeshShape)tori with the circular path twisted.
http://www.youtube.com/watch?v=P5EN-d4C1d0
Looks like the angular velocity on the sphere isn't quite right in the video
while in the tori.. but the issue hasn't been isolated specifically to the
physics engine (EX, That could be an issue with the integration code)
Original comment by dcoliva...@gmail.com
on 20 Apr 2011 at 2:11
Did some more testing last night on the pyramid/cube collision fail. Can
re-create it, but not pin it down yet. Tired sphere/pyramid, capsule/pyramid
and cylinder/pyramid and they seemed to collide correctly. Will keep you
updated.
Original comment by xexu...@gmail.com
on 20 Apr 2011 at 8:22
Original comment by xexu...@gmail.com
on 24 Apr 2011 at 9:19
I'm still studying this issue. Just a FYI. So far, it looks like the line
that's going 'awry' is:
if (AabbUtil2.TestTriangleAgainstAabb2(triangle,ref m_aabbMin,ref m_aabbMax))
inside TriangleMeshShape.cs NameSpace
BulletXNA.BulletCollision.CollisionShapes.FilteredCallback.InternalProcessTriang
leIndex.
We know it's trying to compare an AABB to a triangle. The issue is the test
is returning false on some faces. The test occurs when the avatar's CapsuleZ
is within the AABB of the object.. which is proper.. but returns false when
it should return true.
Original comment by dcoliva...@gmail.com
on 3 Jun 2011 at 4:25
After studying this, It's looking more like an integration code problem.
The last 9 triangles are copies of the 4th triangle.
Original comment by dcoliva...@gmail.com
on 3 Jun 2011 at 5:41
btshapeArray = new TriangleIndexVertexArray(IndexCount / 3, indexels, (3 *
sizeof(int)), VertexCount, vertexels, 3 * sizeof(float));
to
btshapeArray = new TriangleIndexVertexArray(IndexCount / 3, indexels, 3,
VertexCount, vertexels, 1);
and that seems to fix most of the issues. There's still an issue or two on
some of the more complex objects... and, for the most part it seems to be
working well.
Original comment by dcoliva...@gmail.com
on 3 Jun 2011 at 6:26
Thanks Dan.
I need to go through and standardise the whole use of stride counts in the
various parts of the code as it's rather 'organic'
I think that for now I'll support float arrays and Vector3 arrays /
objectarrays for vertex data and just int types for index data.
Would this fit in with the way you use it, or are there other forms of data
you'd like to use?
Original comment by xexu...@gmail.com
on 3 Jun 2011 at 12:34
I tend to use float[]/int[] where float[] is a lookup array, int[] contains a
strided/ordered index and a vertex is composed of
<float[int[x]],float[int[x+1]],float[int[x+2]]> and a triangle consists of
x=tri*vertex.
I note, that that isn't always the most optimal way to manage it memory-wise.
Some people prefer to use a smaller bit space because of simplicity when
dealing with a data format or limited memory space.
To ensure compatibility with native c++ libraries, I tend to create the arrays
and pin them in memory so .NET doesn't move them around.
My Current snippet looks like:
IMesh mesh = Mesher.CreateMesh(shapeData);
float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that
vertextList is pinned in memory
int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release
after usage
mesh.releaseSourceMeshData(); // free up the original mesh data to save memory
int VertexCount = indexList.GetLength(0) / 3;
int IndexCount = indexList.GetLength(0);
ObjectArray<int> indexels = new ObjectArray<int>();
for (int i=0;i<IndexCount;i++)
{
indexels.Add(indexList[i]);
}
ObjectArray<Vector3> vertexels = new ObjectArray<Vector3>();
for (int i=0;i<VertexCount;i++)
{
vertexels.Add(new btVector3(vertexList[i * 3], vertexList[(i * 3) + 1], vertexList[(i * 3) + 2]));
}
btshapeArray = new TriangleIndexVertexArray(IndexCount / 3, indexels, 3,
VertexCount, vertexels, 1);
(I came up with this quick set of loops to enter the array data into the object
array list that the constructor for TriangleindexVertexArray is expecting.)
Original comment by dcoliva...@gmail.com
on 3 Jun 2011 at 2:21
A few tri-mesh videos:
http://www.youtube.com/watch?v=bHSnIswAZ8U <-- sphere traversing tri-mesh course
http://www.youtube.com/watch?v=ubNawFkLMCM <-- obligatory 'run through wall'
test.
http://www.youtube.com/watch?v=de73aywRxWQ <-- 112 cube boxstack test.
Original comment by dcoliva...@gmail.com
on 4 Jun 2011 at 12:14
Updated MathUtil.cs - fixes the fallthrough - at least in my testbed. Can you
give it a try when you get chance please.
Original comment by xexu...@gmail.com
on 5 Jun 2011 at 8:19
For the most part, this seems to be resolved for TriangleMeshShape.
I noticed another issue, however that might be related where it doesn't apply
enough resolution force to keep the objects apart and one falls through the
other. Note that this is cubes and spheres on the inside of a hollow half
sphere concave tri-mesh.
This may be worthy of a separate bug. Let me know.
Here's a video of it in action:
http://www.youtube.com/watch?v=Ty0R-7eI4Lk
Original comment by dcoliva...@gmail.com
on 7 Jun 2011 at 6:05
yup , if you put that as a separate issue that would be good thanks. as ever if
you have any details on the models / collisions objects that would be handy as
well.
ta
Original comment by xexu...@gmail.com
on 8 Jun 2011 at 4:00
Original issue reported on code.google.com by
dcoliva...@gmail.com
on 15 Apr 2011 at 2:02