public static btSoftBody CreateFromConvexHull(btSoftBodyWorldInfo worldInfo, btAlignedObjectArrayVector3 vertices) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreateFromConvexHull__SWIG_3(btSoftBodyWorldInfo.getCPtr(worldInfo), btAlignedObjectArrayVector3.getCPtr(vertices)); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static btSoftBody CreateFromTetGenData(btSoftBodyWorldInfo worldInfo, string ele, string face, string node, bool bfacelinks, bool btetralinks, bool bfacesfromtetras) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreateFromTetGenData(btSoftBodyWorldInfo.getCPtr(worldInfo), ele, face, node, bfacelinks, btetralinks, bfacesfromtetras); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static btSoftBody CreateFromConvexHull(btSoftBodyWorldInfo worldInfo, SWIGTYPE_p_btVector3 vertices, int nvertices, bool randomizeConstraints) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreateFromConvexHull__SWIG_0(btSoftBodyWorldInfo.getCPtr(worldInfo), SWIGTYPE_p_btVector3.getCPtr(vertices), nvertices, randomizeConstraints); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static btSoftBody CreateFromTriMesh(btSoftBodyWorldInfo worldInfo, float[] vertices, int[] triangles, int ntriangles) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreateFromTriMesh__SWIG_1(btSoftBodyWorldInfo.getCPtr(worldInfo), vertices, triangles, ntriangles); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static btSoftBody CreateEllipsoid(btSoftBodyWorldInfo worldInfo, SWIGTYPE_p_btVector3 center, SWIGTYPE_p_btVector3 radius, int res) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreateEllipsoid(btSoftBodyWorldInfo.getCPtr(worldInfo), SWIGTYPE_p_btVector3.getCPtr(center), SWIGTYPE_p_btVector3.getCPtr(radius), res); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static btSoftBody CreatePatchUV(btSoftBodyWorldInfo worldInfo, SWIGTYPE_p_btVector3 corner00, SWIGTYPE_p_btVector3 corner10, SWIGTYPE_p_btVector3 corner01, SWIGTYPE_p_btVector3 corner11, int resx, int resy, int fixeds, bool gendiags) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreatePatchUV__SWIG_1(btSoftBodyWorldInfo.getCPtr(worldInfo), SWIGTYPE_p_btVector3.getCPtr(corner00), SWIGTYPE_p_btVector3.getCPtr(corner10), SWIGTYPE_p_btVector3.getCPtr(corner01), SWIGTYPE_p_btVector3.getCPtr(corner11), resx, resy, fixeds, gendiags); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static btSoftBody CreateRope(btSoftBodyWorldInfo worldInfo, SWIGTYPE_p_btVector3 from, SWIGTYPE_p_btVector3 to, int res, int fixeds) { IntPtr cPtr = BulletSoftBodyPINVOKE.btSoftBodyHelpers_CreateRope(btSoftBodyWorldInfo.getCPtr(worldInfo), SWIGTYPE_p_btVector3.getCPtr(from), SWIGTYPE_p_btVector3.getCPtr(to), res, fixeds); btSoftBody ret = (cPtr == IntPtr.Zero) ? null : new btSoftBody(cPtr, false); if (BulletSoftBodyPINVOKE.SWIGPendingException.Pending) { throw BulletSoftBodyPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public btSoftBody(btSoftBodyWorldInfo worldInfo) : this(BulletSoftBodyPINVOKE.new_btSoftBody__SWIG_1(btSoftBodyWorldInfo.getCPtr(worldInfo)), true) { }
public btSoftBody(btSoftBodyWorldInfo worldInfo, int node_count, SWIGTYPE_p_btVector3 x, SWIGTYPE_p_float m) : this(BulletSoftBodyPINVOKE.new_btSoftBody__SWIG_0(btSoftBodyWorldInfo.getCPtr(worldInfo), node_count, SWIGTYPE_p_btVector3.getCPtr(x), SWIGTYPE_p_float.getCPtr(m)), true) { }
internal static HandleRef getCPtr(btSoftBodyWorldInfo obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public btSoftBodyWorldInfo getWorldInfo() { btSoftBodyWorldInfo ret = new btSoftBodyWorldInfo(BulletSoftBodyPINVOKE.btSoftRigidDynamicsWorld_getWorldInfo__SWIG_0(swigCPtr), false); return(ret); }
public bool OnBulletCreate(btSoftBodyWorldInfo softBodyWorldInfo) { if( softBodyType == SoftBodyType.Patch ) { Vector3 c00 = transform.TransformPoint(PatchCorner00); Vector3 c01 = transform.TransformPoint(PatchCorner01); Vector3 c10 = transform.TransformPoint(PatchCorner10); Vector3 c11 = transform.TransformPoint(PatchCorner11); btVector3 corner00 = new btVector3(c00.x,c00.y,c00.z); btVector3 corner01 = new btVector3(c01.x,c01.y,c01.z); btVector3 corner10 = new btVector3(c10.x,c10.y,c10.z); btVector3 corner11 = new btVector3(c11.x,c11.y,c11.z); int fixFlag = 0; if( CornerFix00 ) fixFlag = 1; if ( CornerFix01 ) fixFlag += 4; if( CornerFix10 ) fixFlag += 2; if( CornerFix11 ) fixFlag += 8; softBody = btSoftBodyHelpers.CreatePatch(softBodyWorldInfo,corner00.GetSwigPtr(),corner10.GetSwigPtr(),corner01.GetSwigPtr(),corner11.GetSwigPtr(), PatchResolutionX,PatchResolutionY,fixFlag,true); collisionObject = btCollisionObject.GetObjectFromSwigPtr(softBody.GetCollisionObject()); SetParam(); SpawnMesh(); return true; } else if( softBodyType == SoftBodyType.Ellipsoid ) { btVector3 center = new btVector3(transform.position.x,transform.position.y,transform.position.z); btVector3 radius = new btVector3(EllipsoidRadius.x*transform.localScale.x,EllipsoidRadius.y*transform.localScale.y, EllipsoidRadius.z*transform.localScale.z); softBody = btSoftBodyHelpers.CreateEllipsoid(softBodyWorldInfo,center.GetSwigPtr(),radius.GetSwigPtr(),MeshResolution); SetParam(); SpawnMesh(); return true; } else if( softBodyType == SoftBodyType.Rope ) { int fixFlag = 0; if(FixRopeBegin) fixFlag += 1; if( FixRopeEnd ) fixFlag += 2; Vector3 begin = transform.TransformPoint(RopeFromPos); Vector3 end = transform.TransformPoint(RopeToPos); btVector3 fromPos = new btVector3(begin.x,begin.y,begin.z); btVector3 toPos = new btVector3(end.x,end.y,end.z); softBody = btSoftBodyHelpers.CreateRope(softBodyWorldInfo,fromPos.GetSwigPtr(),toPos.GetSwigPtr(),RopeResolution,fixFlag); SetParam(); SpawnLineRender(); return true; } else if( softBodyType == SoftBodyType.TriangleMesh ) { if(CheckUnityMesh() == false) return false; CreateBulletStyleMesh(); List<float> vertexposList = new List<float>(); for(int index=0;index<btVectorArray.Length;index++) { Vector3 vec = btVectorArray[index]; vec = transform.TransformPoint(vec); vertexposList.Add(vec.x); vertexposList.Add(vec.y); vertexposList.Add(vec.z); } softBody = btSoftBodyHelpers.CreateFromTriMesh(softBodyWorldInfo,vertexposList.ToArray(),btTriangleArray,btTriangleArray.Length/3); SetParam(); return true; } return false; }
public btSoftBodyWorldInfo getWorldInfo() { btSoftBodyWorldInfo ret = new btSoftBodyWorldInfo(BulletSoftBodyPINVOKE.btSoftRigidDynamicsWorld_getWorldInfo__SWIG_0(swigCPtr), false); return ret; }
internal static HandleRef getCPtr(btSoftBodyWorldInfo obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
void CreateSoftDynamicsWorld() { btVector3 gravityVec = new btVector3(Gravity.x, Gravity.y, Gravity.z); btCollisionObject tempObject = new btCollisionObject(); btConstraintSetting tempObject2 = new btConstraintSetting(); softBodyWorldInfo = new btSoftBodyWorldInfo(); ///collision configuration contains default setup for memory, collision setup. Advanced users can create their own configuration. softCollisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration(); ///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded) dispatcher = new btCollisionDispatcher(softCollisionConfiguration.GetSwigPtr()); softBodyWorldInfo.m_dispatcher = dispatcher.GetSwigPtr(); btVector3 worldAabbMin = new btVector3(-1000,-1000,-1000); btVector3 worldAabbMax = new btVector3(1000,1000,1000); axisBroadphase = new btAxisSweep3(worldAabbMin.GetSwigPtr(),worldAabbMax.GetSwigPtr(),32766); softBodyWorldInfo.m_broadphase = axisBroadphase.GetSwigPtr(); ///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded) solver = new btSequentialImpulseConstraintSolver(); softDynamicsWorld = new btSoftRigidDynamicsWorld(dispatcher.GetSwigPtr(), axisBroadphase.GetSwigPtr(), solver.GetSwigPtr(), softCollisionConfiguration.GetSwigPtr()); dynamicsWorld = btDiscreteDynamicsWorld.GetObjectFromSwigPtr(softDynamicsWorld.getDiscreteDynamicsWorld()); SWIGTYPE_p_btCollisionWorld collisionWorldPtr = dynamicsWorld.getCollisionWorld(); collisionWorld = btCollisionWorld.GetObjectFromSwigPtr(collisionWorldPtr); dynamicsWorld.setGravity(gravityVec.GetSwigPtr()); softBodyWorldInfo.m_gravity = gravityVec.GetSwigPtr(); btVector3 water_nomalVec = new btVector3(0,0,0); softBodyWorldInfo.air_density = 1.2f; softBodyWorldInfo.water_density = 0; softBodyWorldInfo.water_offset = 0; softBodyWorldInfo.water_normal = water_nomalVec.GetSwigPtr(); sparseSdf = softBodyWorldInfo.m_sparsesdf; sparseSdf.Initialize(); AddBulletObjects(); }