collision detection of rotated vertex_buffer

Started by
6 comments, last by Kurt-olsson 11 years, 6 months ago
i have a big static vertex_buffer that is my gamelevel.

i can transform it and rotate/scale etc with DirectXAPI.
But if i want to perform calculations for my collision detection i need the transformed vertex points in my vertex_buffer.

is there a way i can copy back a transformed vertex_buffer so i can test all my triangles for collision detection.

Or should i perform transformation on my vertexbuffer before i copy them for rendering?
Advertisement
why do you tarnsform your level? eys you should transform verts once and then check collision or store two vb one standard second rotated, if you want to check for collision transformed vert in fly you should consider that this will require more computations = slower, so transform them one and then check, BUT the best solution for you(if your scene objects are in example always rtoating ) transform the collision test points not whole vertex array, do you understand me?
yeah i think i understand.
It is in the way you say with my level. i want lots of parts of my level to roate and go from different positions. Kind of like Uncharted game when the floor gives in and the player slides down.

i think the best way for me would be to transform my vertex array before i copy it to the buffer. that way i always have the updated array.

But it feels not good doing this because all my rotations is made by the CPU right?
can i user D3DXMatrixRotate.. on a vertex-struct array?

It would be great if i could use the DirectX API as usual for transforming my verticies...
You could just apply the same transformations to the collision shapes in the physics engine. (Even if you run your physics on the CPU the collision shapes should be far less complex than the actual geometry so CPU side transformations of these won't be as expensive)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

Kind of like Uncharted game when the floor gives in and the player slides down.
I bet this floor is not part of the level. It's likely an entity which gets drawn very similarly to the level.

i think the best way for me would be to transform my vertex array before i copy it to the buffer. that way i always have the updated array.
In Bullet, your level would be a shape. From that, we would create a rigidbody using that shape, and the rigidbody would apply a transformation to the shape. This is the established way to approach this problem and I'm inclined to think it is the best way.

Previously "Krohm"


[quote name='KurtO' timestamp='1349767617' post='4988245']
Kind of like Uncharted game when the floor gives in and the player slides down.
I bet this floor is not part of the level. It's likely an entity which gets drawn very similarly to the level.

i think the best way for me would be to transform my vertex array before i copy it to the buffer. that way i always have the updated array.
In Bullet, your level would be a shape. From that, we would create a rigidbody using that shape, and the rigidbody would apply a transformation to the shape. This is the established way to approach this problem and I'm inclined to think it is the best way.
[/quote]

do you have a sample of that with directx and bullet?
:)
It is a common misconception that Physics has anything to do with graphics. I'm afraid this code does not exist, if it exists, you're better not take it as example.
People using this approach would likely start from btBvhTriangleMeshShape.
Personally I am not a big fan of using a single shape for the whole world so no, I don't have that code available myself. There's a library example however.
Keep in mind that the concept applies to all other shapes as well, let them be a box or a sphere.

Previously "Krohm"

I completely agree with you guyes, but my project is very simple and my level will be only about 2-3000 faces
so i think it is best to combine my "graphics-level" and "physics-level" in one.

I might build a muuuch more simple mesh in blender that will represent collision forms only.
But i almost only have boxes and simple shapes so the triangle count is very low.

This topic is closed to new replies.

Advertisement