11-03-2021, 12:33 PM
how to get the collision point?
thx for your help
thx for your help
about softbody Collision
|
11-03-2021, 12:33 PM
how to get the collision point?
thx for your help
11-03-2021, 12:40 PM
(This post was last modified: 11-03-2021, 12:41 PM by josemendez.)
(11-03-2021, 12:33 PM)zero16832 Wrote: how to get the collision point? It's part of the contact struct. You can get both the point on the simplex surface (as barycentric coordinates) or on the collider surface (expressed in solver space): See: http://obi.virtualmethodstudio.com/tutor...sions.html
11-03-2021, 12:48 PM
(11-03-2021, 12:40 PM)josemendez Wrote: It's part of the contact struct. You can get both the point on the simplex surface (as barycentric coordinates) or on the collider surface (expressed in solver space):I just need the first collision point witch api can i use?
11-03-2021, 12:54 PM
(This post was last modified: 11-03-2021, 12:54 PM by josemendez.)
11-03-2021, 12:58 PM
11-03-2021, 02:53 PM
(11-03-2021, 12:58 PM)zero16832 Wrote: I make a ground and a control softbody in scene . when the sofybody collision with the ground,this first collision It’s not entirely clear to me, sorry. First collision since when? in the game? since last time the ground and the softbody where in contact? First particle that contacts the ground? First contact reported in the list of contacts for a single frame? An object might collide with another during a single frame, or multiple frames. You can get all contacts for the current frame using the collision callbacks API, see the link above. You can simply subscribe to the OnCollision event and grab the first contact in the list, if that’s what you are after.
20-02-2022, 05:07 AM
I'm hoping to get extra detail on this question.
Would it be possible to give an example or an explanation of how to convert from both barycentric coordinates and solver space to global space? Thank you for any help you can give!
21-02-2022, 08:29 AM
(This post was last modified: 21-02-2022, 08:36 AM by josemendez.)
(20-02-2022, 05:07 AM)drmgmt32 Wrote: I'm hoping to get extra detail on this question. Unity has built-in functions to convert data between spaces, as it's very a basic and common operation. See the Transform class: https://docs.unity3d.com/ScriptReference/Transform.html The methods you're interested in are: TransformPoint/Direction/Vector: from local space to global space. InverseTransformPoint/Direction/Vector: from global space to local space. So to transform a particle position from the solver's local space to global space: Code: var worldPos = solver.transform.TransformPoint(solver.positions[index]); You should definitely get familiar with vector spaces and converting data between them, as it's paramount when making games of any kind. There's a lot of online resources regarding vector spaces. For instance: https://m-ansley.medium.com/local-space-...0e0bfb7694 http://blog.lidia-martinez.com/transform...ebra-unity Barycentric coordinates are also very common. Given the barycentric coordinates of a point in a triangle, you get the point by simply multiplying each coordinate by the corresponding vertex, and adding it all together: Code: // "t" is the triangle, "bary" the barycentric coords. If the triangle was expressed in some transform's local space -like a triangle simplex in Obi- and you want the result in global (aka "world") space, you'd just use the above functions. let me know if you need further help. kind regards, |
« Next Oldest | Next Newest »
|