开发者

Shape casting a capsule against convex polyhedra

开发者 https://www.devze.com 2023-03-29 08:04 出处:网络
Let\'s say I have a upright capsule shape (swept sphere) that I would like to cast it along a velocity vector. I would like to be able to find the point of contact and a surface normal for any convex

Let's say I have a upright capsule shape (swept sphere) that I would like to cast it along a velocity vector. I would like to be able to find the point of contact and a surface normal for any convex shapes it would intersect along this path. I would also like to find the distance the swept caspule traveled to the point of first contact.

Heres a quick diagram of a capsule being casted against a large convex polyhedra (only one face is drawn)

Shape casting a capsule against convex polyhedra

What kind of algorith开发者_运维问答m or process could do this? I assume it would be similar to a sphere-cast, but i can't find much on that either.


Since you are considering capsules and convex polyhedra, I suppose you could use something based on GJK. You would get the point of contact and a surface normal during a collision, and the minimum distance between the objects and the associated witness points if there is no collision.

You can also take a look at this publication on Interactive and Continuous Collision Detection for Avatars in Virtual Environments.


Right if its the same as your diagram then finding where it collides is the easy part. Get the circles x and y coordinates and plus '+' the radius of the circle. If that point is at the line of the path then its a collision. The line will have to be found using the line equation here y = mx+c.

The distance can be calculated by setting an intial values of x and y. and then when the object hits set final variables to x and y again. then just the lenght of a line formula to calculate the distance travelled.

The problem is im going on what i know from C++ and i dont know what your programming in.

i think you wanted something else but cant work out what that is from paragraph.

0

精彩评论

暂无评论...
验证码 换一张
取 消