tower120 Posted March 23, 2021 Share Posted March 23, 2021 (edited) I looked at docs and couldn't find what I need. UE4's PhysX, in addition to raycasts, have sweep and overlap queries. Moreover, overlap query can return list of overlapped vertices, which allow to construct intersection mesh. Is there anything like this in UNIGINE? I would like to do overlap test of mesh with GlobalWater, and calulate volume of intersection. Edited March 23, 2021 by tower120 Link to comment
silent Posted March 24, 2021 Share Posted March 24, 2021 tower120 For the object that can use physics to do the intersections and collisions tests (like meshes, for example), I guess the closes analogue to sweep and overlap queries is a regular shape intersection. You can just create a shape (box, sphere or custom) and ask him for the collisions surfaces. WaterGlobal doesn't have any triangles (until it gets rendered on a screen) since it's purely analytical, so you can only ask for the specific height of the water surfaces in the specific point (via getHeight() method) and do the regular non-physics intersections. If you want to make ships to sail on WaterGlobal I would recommend you to check the implementation of the buoancy from the Oil Platform demo (which is not available in Community SDK): And small example is also availble in UnigineScript: SDK Browser -> Samples -> UnigineScript -> World Management -> expression_01. 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tower120 Posted March 24, 2021 Author Share Posted March 24, 2021 1 hour ago, silent said: For the object that can use physics to do the intersections and collisions tests (like meshes, for example), I guess the closes analogue to sweep and overlap queries is a regular shape intersection. You can just create a shape (box, sphere or custom) and ask him for the collisions surfaces. What exactly api/functions you refer to? I would assume that UNIGINE do have internal functionality for convex mesh-to-mesh intersection tests (I imagine that you absolutely need that for collision detection). 1 hour ago, silent said: WaterGlobal doesn't have any triangles (until it gets rendered on a screen) since it's purely analytical, so you can only ask for the specific height of the water surfaces in the specific point (via getHeight() method) and do the regular non-physics intersections. Saying "purely analytical" you assume it contiguous and non-discreet? 1 hour ago, silent said: And small example is also availble in UnigineScript: SDK Browser -> Samples -> UnigineScript -> World Management -> expression_01. Thanks, I didn't see it. 2 hours ago, silent said: If you want to make ships to sail on WaterGlobal I would recommend you to check the implementation of the buoancy from the Oil Platform demo (which is not available in Community SDK): Thanks, that helped. Looks like, ship volume (which is cuboid) divided into cubes (max 3x8=24). And from center of each cube water height taken , and based on that water displacement volume approximated for that section. Then somewhat approximated uplift "buyouncy force" applied to that sector. Link to comment
silent Posted March 24, 2021 Share Posted March 24, 2021 I was referring to the Shape::getCollision() methods (just called it wrong): https://developer.unigine.com/en/docs/2.13/api/library/physics/class.shape?rlang=cpp#getCollision_VECShapeContact_float_int For WaterGlobal I simply mean that it's just a combination of sine waves and there is no regular triangles available that you can use in combination with physics (as in WaterMesh, for example). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
tower120 Posted March 24, 2021 Author Share Posted March 24, 2021 (edited) 44 minutes ago, silent said: I was referring to the Shape::getCollision() methods (just called it wrong): https://developer.unigine.com/en/docs/2.13/api/library/physics/class.shape?rlang=cpp#getCollision_VECShapeContact_float_int But non of that methods give you MTD(minimum transfer distance) nor overlapped vertices, nor overlap/intersection points. And as I understood - you need to put your objects/shapes into world before doing any intersection probes. Since the world is only one... That would be highly undesirable. For example PhysX have standalone(!) functions for two-objects intersection probes: Sweep - gives you MTD https://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/GeometryQueries.html#sweeps MeshQuery - gives overlapped triangles/vertices https://gameworksdocs.nvidia.com/PhysX/3.4/PhysXAPI/files/classPxMeshQuery.html#ea451debbcaca51f9f1f49df3d5bfe74 Consider this feature request... not complain. EDIT. Ups... Sorry, there is queries which return MTD (inside ShapeContact). But that fact that you need to add object to world hierarchy, to do two-objects intersection probe still holds true. Edited March 24, 2021 by tower120 Link to comment
Recommended Posts