Jump to content

  • Log In with Google      Sign In   
  • Create Account

collision detection of rotated vertex_buffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 08 October 2012 - 03:21 PM

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?

Sponsor:

#2 WiredCat   Members   -  Reputation: 324

Like
0Likes
Like

Posted 08 October 2012 - 08:08 PM

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?

Edited by ___, 08 October 2012 - 08:09 PM.


#3 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 09 October 2012 - 01:26 AM

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...

#4 SimonForsman   Crossbones+   -  Reputation: 6122

Like
1Likes
Like

Posted 09 October 2012 - 02:59 AM

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)
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!

#5 Krohm   Crossbones+   -  Reputation: 3129

Like
0Likes
Like

Posted 10 October 2012 - 01:01 AM

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.

#6 Anddos   Members   -  Reputation: 501

Like
0Likes
Like

Posted 10 October 2012 - 05:58 AM


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.


do you have a sample of that with directx and bullet?
:)

#7 Krohm   Crossbones+   -  Reputation: 3129

Like
0Likes
Like

Posted 10 October 2012 - 07:23 AM

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.

#8 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 10 October 2012 - 07:43 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS