Introduced btActionInterface. This makes it easier to extend user-defined actions, such as vehicles and characters.
btRaycastVehicle and btKinematicCharacterController are derived from btActionInterface now. Some cosmetic cleanup: changed sourceforce/sf.net url to bulletphysics.com.
This commit is contained in:
@@ -87,6 +87,7 @@ void BasicDemo::initPhysics()
|
||||
|
||||
///collision configuration contains default setup for memory, collision setup
|
||||
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||
//m_collisionConfiguration->setConvexConvexMultipointIterations();
|
||||
|
||||
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
|
||||
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
|
||||
@@ -173,6 +174,7 @@ void BasicDemo::initPhysics()
|
||||
btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
|
||||
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,colShape,localInertia);
|
||||
btRigidBody* body = new btRigidBody(rbInfo);
|
||||
//body->setContactProcessingThreshold(colShape->getContactBreakingThreshold());
|
||||
body->setActivationState(ISLAND_SLEEPING);
|
||||
|
||||
m_dynamicsWorld->addRigidBody(body);
|
||||
|
||||
@@ -81,7 +81,7 @@ int main(int argc,char** argv)
|
||||
#ifdef CHECK_MEMORY_LEAKS
|
||||
ccdDemo.exitPhysics();
|
||||
#else
|
||||
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&ccdDemo);
|
||||
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&ccdDemo);
|
||||
#endif
|
||||
|
||||
//default glut doesn't return from mainloop
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc,char** argv)
|
||||
ccdDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
|
||||
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",ccdDemo);
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",ccdDemo);
|
||||
|
||||
delete ccdDemo;
|
||||
return 0;
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "btHfFluid.h"
|
||||
#include "btHfFluidCollisionShape.h"
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifndef __HFFLUID_H
|
||||
#define __HFFLUID_H
|
||||
|
||||
@@ -14,6 +31,7 @@ class btManifoldResult;
|
||||
// add buoyant convex vs. convex / concave
|
||||
// add buoyant concave support (try bunny model)
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
class btHfFluid : public btCollisionObject
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "LinearMath/btAabbUtil2.h"
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
#ifndef __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H
|
||||
#define __BT_HFFLUID_BUOYANT_CONVEX_SHAPE_H
|
||||
|
||||
@@ -7,7 +23,7 @@
|
||||
#define MAX_VOXEL_DIMENSION 32
|
||||
|
||||
class btConvexShape;
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
class btHfFluidBuoyantConvexShape : public btCollisionShape
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "btHfFluidBuoyantShapeCollisionAlgorithm.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifndef HF_FLUID_BUOYANT_SHAPE_COLLISION_ALGORITHM_H
|
||||
@@ -31,6 +33,8 @@ class btHfFluid;
|
||||
class btConvexConvexAlgorithm;
|
||||
class btConvexPenetrationDepthSolver;
|
||||
class btSimplexSolverInterface;
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
/// btHfFluidBuoyantShapeCollisionAlgorithm provides collision detection between btHfFluidBuoyantConvexShape and btHfFluidBuoyantConvexShape
|
||||
class btHfFluidBuoyantShapeCollisionAlgorithm : public btCollisionAlgorithm
|
||||
{
|
||||
|
||||
@@ -1,2 +1,18 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
#include "btHfFluidCollisionShape.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
#ifndef BT_HF_FLUID_COLLISION_SHAPE_H
|
||||
#define BT_HF_FLUID_COLLISION_SHAPE_H
|
||||
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "btHfFluidRigidCollisionAlgorithm.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifndef HF_FLUID_RIGID_COLLISION_ALGORITHM_H
|
||||
@@ -27,6 +29,7 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btVector3.h"
|
||||
class btHfFluid;
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
/// btHfFluidRigidCollisionAlgorithm provides collision detection between btHfFluid and btRigidBody
|
||||
class btHfFluidRigidCollisionAlgorithm : public btCollisionAlgorithm
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include "btHfFluidRigidCollisionConfiguration.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifndef BT_HFFLUID_RIGID_COLLISION_CONFIGURATION
|
||||
@@ -21,7 +23,7 @@ subject to the following restrictions:
|
||||
class btVoronoiSimplexSolver;
|
||||
class btGjkEpaPenetrationDepthSolver;
|
||||
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
///btSoftBodyRigidBodyCollisionConfiguration add softbody interaction on top of btDefaultCollisionConfiguration
|
||||
class btHfFluidRigidCollisionConfiguration : public btDefaultCollisionConfiguration
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
|
||||
@@ -31,6 +33,7 @@ typedef btAlignedObjectArray<btHfFluid*> btHfFluidArray;
|
||||
|
||||
class btHfFluidBuoyantConvexShape;
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
class btHfFluidRigidDynamicsWorld : public btDiscreteDynamicsWorld
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifndef HFFLUID_DEMO_H
|
||||
@@ -32,7 +34,7 @@ class btHfFluidRigidDynamicsWorld;
|
||||
///collisions between a btSoftBody and a btRigidBody
|
||||
class btFluidRididCollisionAlgorithm;
|
||||
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
///CcdPhysicsDemo shows basic stacking using Bullet physics, and allows toggle of Ccd (using key '1')
|
||||
class HfFluidDemo : public DemoApplication
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifdef WIN32 //needed for glut.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,12 +11,16 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#ifndef HFFLUID_GL_SHAPE_DRAWER_H
|
||||
#define HFFLUID_GL_SHAPE_DRAWER_H
|
||||
|
||||
#include "GL_ShapeDrawer.h"
|
||||
|
||||
///experimental buyancy fluid demo
|
||||
/// OpenGL shape drawing
|
||||
class HfFluidDemo_GL_ShapeDrawer : public GL_ShapeDrawer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.com
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@@ -11,6 +11,8 @@ subject to the following restrictions:
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Experimental Buoyancy fluid demo written by John McCutchan
|
||||
*/
|
||||
|
||||
#include "HfFluidDemo.h"
|
||||
@@ -29,7 +31,7 @@ int main(int argc,char** argv)
|
||||
fluidDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
|
||||
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",fluidDemo);
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",fluidDemo);
|
||||
|
||||
delete fluidDemo;
|
||||
return 0;
|
||||
|
||||
@@ -28,7 +28,7 @@ int main(int argc,char** argv)
|
||||
demo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
|
||||
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",demo);
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",demo);
|
||||
|
||||
delete demo;
|
||||
|
||||
|
||||
@@ -27,5 +27,5 @@ int main(int argc,char* argv[])
|
||||
demoApp.initPhysics();
|
||||
demoApp.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
|
||||
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",&demoApp);
|
||||
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&demoApp);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ int main(int argc,char** argv)
|
||||
softDemo->getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||
|
||||
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bullet.sf.net",softDemo);
|
||||
glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",softDemo);
|
||||
|
||||
delete softDemo;
|
||||
return 0;
|
||||
|
||||
@@ -2761,7 +2761,7 @@ bool ColladaConverter::save(const char* filename)
|
||||
}
|
||||
|
||||
m_dom->getAsset()->getContributor_array().get(0)->getAuthor()->setValue
|
||||
("http://bullet.sf.net Erwin Coumans");
|
||||
("http://bulletphysics.com Erwin Coumans");
|
||||
|
||||
if (!m_dom->getAsset()->getContributor_array().get(0)->getAuthoring_tool())
|
||||
{
|
||||
|
||||
@@ -17,12 +17,13 @@ subject to the following restrictions:
|
||||
#define CHARACTER_CONTROLLER_INTERFACE_H
|
||||
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "BulletDynamics/Dynamics/btActionInterface.h"
|
||||
|
||||
class btCollisionShape;
|
||||
class btRigidBody;
|
||||
class btCollisionWorld;
|
||||
|
||||
class btCharacterControllerInterface
|
||||
class btCharacterControllerInterface : public btActionInterface
|
||||
{
|
||||
public:
|
||||
btCharacterControllerInterface () {};
|
||||
|
||||
@@ -116,7 +116,7 @@ btPairCachingGhostObject* btKinematicCharacterController::getGhostObject()
|
||||
return m_ghostObject;
|
||||
}
|
||||
|
||||
bool btKinematicCharacterController::recoverFromPenetration (btCollisionWorld* collisionWorld)
|
||||
bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld* collisionWorld)
|
||||
{
|
||||
|
||||
bool penetration = false;
|
||||
@@ -390,7 +390,7 @@ void btKinematicCharacterController::warp (const btVector3& origin)
|
||||
}
|
||||
|
||||
|
||||
void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld)
|
||||
void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld)
|
||||
{
|
||||
|
||||
int numPenetrationLoops = 0;
|
||||
@@ -413,7 +413,7 @@ void btKinematicCharacterController::preStep ( btCollisionWorld* collisionWorld)
|
||||
|
||||
}
|
||||
|
||||
void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWorld, btScalar dt)
|
||||
void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWorld, btScalar dt)
|
||||
{
|
||||
btTransform xform;
|
||||
xform = m_ghostObject->getWorldTransform ();
|
||||
@@ -469,3 +469,8 @@ bool btKinematicCharacterController::onGround () const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void btKinematicCharacterController::debugDraw(btIDebugDraw* debugDrawer)
|
||||
{
|
||||
}
|
||||
@@ -69,7 +69,7 @@ protected:
|
||||
btVector3 parallelComponent (const btVector3& direction, const btVector3& normal);
|
||||
btVector3 perpindicularComponent (const btVector3& direction, const btVector3& normal);
|
||||
|
||||
bool recoverFromPenetration (btCollisionWorld* collisionWorld);
|
||||
bool recoverFromPenetration ( btCollisionWorld* collisionWorld);
|
||||
void stepUp (btCollisionWorld* collisionWorld);
|
||||
void updateTargetPositionBasedOnCollision (const btVector3& hit_normal, btScalar tangentMag = btScalar(0.0), btScalar normalMag = btScalar(1.0));
|
||||
void stepForwardAndStrafe (btCollisionWorld* collisionWorld, const btVector3& walkMove);
|
||||
@@ -78,6 +78,17 @@ public:
|
||||
btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,btScalar stepHeight, int upAxis = 1);
|
||||
~btKinematicCharacterController ();
|
||||
|
||||
|
||||
///btActionInterface interface
|
||||
virtual void updateAction( btCollisionWorld* collisionWorld,btScalar deltaTime)
|
||||
{
|
||||
preStep ( collisionWorld);
|
||||
playerStep (collisionWorld, deltaTime);
|
||||
}
|
||||
|
||||
///btActionInterface interface
|
||||
void debugDraw(btIDebugDraw* debugDrawer);
|
||||
|
||||
void setUpAxis (int axis)
|
||||
{
|
||||
if (axis < 0)
|
||||
@@ -95,8 +106,8 @@ public:
|
||||
void reset ();
|
||||
void warp (const btVector3& origin);
|
||||
|
||||
void preStep ( btCollisionWorld* collisionWorld);
|
||||
void playerStep (btCollisionWorld* collisionWorld, btScalar dt);
|
||||
void preStep ( btCollisionWorld* collisionWorld);
|
||||
void playerStep ( btCollisionWorld* collisionWorld, btScalar dt);
|
||||
|
||||
void setFallSpeed (btScalar fallSpeed);
|
||||
void setJumpSpeed (btScalar jumpSpeed);
|
||||
|
||||
@@ -30,7 +30,6 @@ enum btTypedConstraintType
|
||||
HINGE_CONSTRAINT_TYPE,
|
||||
CONETWIST_CONSTRAINT_TYPE,
|
||||
D6_CONSTRAINT_TYPE,
|
||||
VEHICLE_CONSTRAINT_TYPE,
|
||||
SLIDER_CONSTRAINT_TYPE
|
||||
};
|
||||
|
||||
|
||||
39
src/BulletDynamics/Dynamics/btActionInterface.h
Normal file
39
src/BulletDynamics/Dynamics/btActionInterface.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _BT_ACTION_INTERFACE_H
|
||||
#define _BT_ACTION_INTERFACE_H
|
||||
|
||||
class btIDebugDraw;
|
||||
class btCollisionWorld;
|
||||
|
||||
#include "LinearMath/btScalar.h"
|
||||
|
||||
///Basic interface to allow actions such as vehicles and characters to be updated inside a btDynamicsWorld
|
||||
class btActionInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~btActionInterface()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void updateAction( btCollisionWorld* collisionWorld, btScalar deltaTimeStep)=0;
|
||||
|
||||
virtual void debugDraw(btIDebugDraw* debugDrawer) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif //_BT_ACTION_INTERFACE_H
|
||||
@@ -90,8 +90,7 @@ void btContinuousDynamicsWorld::internalSingleStepSimulation( btScalar timeStep)
|
||||
integrateTransforms(timeStep * toi);
|
||||
|
||||
///update vehicle simulation
|
||||
updateVehicles(timeStep);
|
||||
|
||||
updateActions(timeStep);
|
||||
|
||||
updateActivationState( timeStep );
|
||||
|
||||
|
||||
@@ -51,15 +51,7 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btIDebugDraw.h"
|
||||
|
||||
|
||||
|
||||
//vehicle
|
||||
#include "BulletDynamics/Vehicle/btRaycastVehicle.h"
|
||||
#include "BulletDynamics/Vehicle/btVehicleRaycaster.h"
|
||||
#include "BulletDynamics/Vehicle/btWheelInfo.h"
|
||||
//character
|
||||
#include "BulletDynamics/Character/btCharacterControllerInterface.h"
|
||||
|
||||
#include "LinearMath/btIDebugDraw.h"
|
||||
#include "BulletDynamics/Dynamics/btActionInterface.h"
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
#include "LinearMath/btMotionState.h"
|
||||
|
||||
@@ -212,32 +204,11 @@ void btDiscreteDynamicsWorld::debugDrawWorld()
|
||||
|
||||
}
|
||||
|
||||
for ( i=0;i<this->m_vehicles.size();i++)
|
||||
if (getDebugDrawer() && getDebugDrawer()->getDebugMode())
|
||||
{
|
||||
for (int v=0;v<m_vehicles[i]->getNumWheels();v++)
|
||||
for (i=0;i<m_actions.size();i++)
|
||||
{
|
||||
btVector3 wheelColor(0,255,255);
|
||||
if (m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_isInContact)
|
||||
{
|
||||
wheelColor.setValue(0,0,255);
|
||||
} else
|
||||
{
|
||||
wheelColor.setValue(255,0,255);
|
||||
}
|
||||
|
||||
btVector3 wheelPosWS = m_vehicles[i]->getWheelInfo(v).m_worldTransform.getOrigin();
|
||||
|
||||
btVector3 axle = btVector3(
|
||||
m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[0][m_vehicles[i]->getRightAxis()],
|
||||
m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[1][m_vehicles[i]->getRightAxis()],
|
||||
m_vehicles[i]->getWheelInfo(v).m_worldTransform.getBasis()[2][m_vehicles[i]->getRightAxis()]);
|
||||
|
||||
|
||||
//m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_wheelAxleWS
|
||||
//debug wheels (cylinders)
|
||||
m_debugDrawer->drawLine(wheelPosWS,wheelPosWS+axle,wheelColor);
|
||||
m_debugDrawer->drawLine(wheelPosWS,m_vehicles[i]->getWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor);
|
||||
|
||||
m_actions[i]->debugDraw(m_debugDrawer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,7 +280,7 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
||||
synchronizeSingleMotionState(body);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawWireframe)
|
||||
{
|
||||
for ( int i=0;i<this->m_vehicles.size();i++)
|
||||
@@ -321,6 +292,8 @@ void btDiscreteDynamicsWorld::synchronizeMotionStates()
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -426,9 +399,7 @@ void btDiscreteDynamicsWorld::internalSingleStepSimulation(btScalar timeStep)
|
||||
integrateTransforms(timeStep);
|
||||
|
||||
///update vehicle simulation
|
||||
updateVehicles(timeStep);
|
||||
|
||||
updateCharacters(timeStep);
|
||||
updateActions(timeStep);
|
||||
|
||||
updateActivationState( timeStep );
|
||||
|
||||
@@ -493,30 +464,16 @@ void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body, short group, short
|
||||
}
|
||||
|
||||
|
||||
void btDiscreteDynamicsWorld::updateVehicles(btScalar timeStep)
|
||||
void btDiscreteDynamicsWorld::updateActions(btScalar timeStep)
|
||||
{
|
||||
BT_PROFILE("updateVehicles");
|
||||
BT_PROFILE("updateActions");
|
||||
|
||||
for ( int i=0;i<m_vehicles.size();i++)
|
||||
for ( int i=0;i<m_actions.size();i++)
|
||||
{
|
||||
btRaycastVehicle* vehicle = m_vehicles[i];
|
||||
vehicle->updateVehicle( timeStep);
|
||||
m_actions[i]->updateAction( this, timeStep);
|
||||
}
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::updateCharacters(btScalar timeStep)
|
||||
{
|
||||
BT_PROFILE("updateCharacters");
|
||||
|
||||
for ( int i=0;i<m_characters.size();i++)
|
||||
{
|
||||
btCharacterControllerInterface* character = m_characters[i];
|
||||
character->preStep (this);
|
||||
character->playerStep (this,timeStep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btDiscreteDynamicsWorld::updateActivationState(btScalar timeStep)
|
||||
{
|
||||
@@ -572,24 +529,35 @@ void btDiscreteDynamicsWorld::removeConstraint(btTypedConstraint* constraint)
|
||||
constraint->getRigidBodyB().removeConstraintRef(constraint);
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::addVehicle(btRaycastVehicle* vehicle)
|
||||
void btDiscreteDynamicsWorld::addAction(btActionInterface* action)
|
||||
{
|
||||
m_vehicles.push_back(vehicle);
|
||||
m_actions.push_back(action);
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::removeVehicle(btRaycastVehicle* vehicle)
|
||||
void btDiscreteDynamicsWorld::removeAction(btActionInterface* action)
|
||||
{
|
||||
m_vehicles.remove(vehicle);
|
||||
m_actions.remove(action);
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::addCharacter(btCharacterControllerInterface* character)
|
||||
|
||||
void btDiscreteDynamicsWorld::addVehicle(btActionInterface* vehicle)
|
||||
{
|
||||
m_characters.push_back(character);
|
||||
addAction(vehicle);
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::removeCharacter(btCharacterControllerInterface* character)
|
||||
void btDiscreteDynamicsWorld::removeVehicle(btActionInterface* vehicle)
|
||||
{
|
||||
m_characters.remove(character);
|
||||
removeAction(vehicle);
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::addCharacter(btActionInterface* character)
|
||||
{
|
||||
addAction(character);
|
||||
}
|
||||
|
||||
void btDiscreteDynamicsWorld::removeCharacter(btActionInterface* character)
|
||||
{
|
||||
removeAction(character);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,10 +23,8 @@ class btOverlappingPairCache;
|
||||
class btConstraintSolver;
|
||||
class btSimulationIslandManager;
|
||||
class btTypedConstraint;
|
||||
class btActionInterface;
|
||||
|
||||
|
||||
class btRaycastVehicle;
|
||||
class btCharacterControllerInterface;
|
||||
class btIDebugDraw;
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
|
||||
@@ -52,11 +50,7 @@ protected:
|
||||
bool m_ownsIslandManager;
|
||||
bool m_ownsConstraintSolver;
|
||||
|
||||
|
||||
btAlignedObjectArray<btRaycastVehicle*> m_vehicles;
|
||||
|
||||
btAlignedObjectArray<btCharacterControllerInterface*> m_characters;
|
||||
|
||||
btAlignedObjectArray<btActionInterface*> m_actions;
|
||||
|
||||
int m_profileTimings;
|
||||
|
||||
@@ -70,9 +64,7 @@ protected:
|
||||
|
||||
void updateActivationState(btScalar timeStep);
|
||||
|
||||
void updateVehicles(btScalar timeStep);
|
||||
|
||||
void updateCharacters(btScalar timeStep);
|
||||
void updateActions(btScalar timeStep);
|
||||
|
||||
void startProfiling(btScalar timeStep);
|
||||
|
||||
@@ -105,14 +97,9 @@ public:
|
||||
|
||||
virtual void removeConstraint(btTypedConstraint* constraint);
|
||||
|
||||
virtual void addVehicle(btRaycastVehicle* vehicle);
|
||||
|
||||
virtual void removeVehicle(btRaycastVehicle* vehicle);
|
||||
|
||||
virtual void addCharacter(btCharacterControllerInterface* character);
|
||||
|
||||
virtual void removeCharacter(btCharacterControllerInterface* character);
|
||||
virtual void addAction(btActionInterface*);
|
||||
|
||||
virtual void removeAction(btActionInterface*);
|
||||
|
||||
btSimulationIslandManager* getSimulationIslandManager()
|
||||
{
|
||||
@@ -130,6 +117,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void setGravity(const btVector3& gravity);
|
||||
|
||||
virtual btVector3 getGravity () const;
|
||||
|
||||
virtual void addRigidBody(btRigidBody* body);
|
||||
@@ -171,6 +159,15 @@ public:
|
||||
(void) numTasks;
|
||||
}
|
||||
|
||||
///obsolete, use addAction instead
|
||||
virtual void addVehicle(btActionInterface* vehicle);
|
||||
///obsolete, use removeAction instead
|
||||
virtual void removeVehicle(btActionInterface* vehicle);
|
||||
///obsolete, use addAction instead
|
||||
virtual void addCharacter(btActionInterface* character);
|
||||
///obsolete, use removeAction instead
|
||||
virtual void removeCharacter(btActionInterface* character);
|
||||
|
||||
};
|
||||
|
||||
#endif //BT_DISCRETE_DYNAMICS_WORLD_H
|
||||
|
||||
@@ -20,10 +20,10 @@ subject to the following restrictions:
|
||||
#include "BulletDynamics/ConstraintSolver/btContactSolverInfo.h"
|
||||
|
||||
class btTypedConstraint;
|
||||
class btRaycastVehicle;
|
||||
class btActionInterface;
|
||||
class btConstraintSolver;
|
||||
class btDynamicsWorld;
|
||||
class btCharacterControllerInterface;
|
||||
|
||||
|
||||
/// Type for the callback for each tick
|
||||
typedef void (*btInternalTickCallback)(btDynamicsWorld *world, btScalar timeStep);
|
||||
@@ -72,14 +72,9 @@ public:
|
||||
|
||||
virtual void removeConstraint(btTypedConstraint* constraint) {(void)constraint;}
|
||||
|
||||
virtual void addVehicle(btRaycastVehicle* vehicle) {(void)vehicle;}
|
||||
|
||||
virtual void removeVehicle(btRaycastVehicle* vehicle) {(void)vehicle;}
|
||||
|
||||
virtual void addCharacter(btCharacterControllerInterface* character) {(void)character;}
|
||||
|
||||
virtual void removeCharacter(btCharacterControllerInterface* character) {(void)character;}
|
||||
virtual void addAction(btActionInterface* action) = 0;
|
||||
|
||||
virtual void removeAction(btActionInterface* action) = 0;
|
||||
|
||||
//once a rigidbody is added to the dynamics world, it will get this gravity assigned
|
||||
//existing rigidbodies in the world get gravity assigned too, during this method
|
||||
@@ -129,6 +124,16 @@ public:
|
||||
}
|
||||
|
||||
|
||||
///obsolete, use addAction instead.
|
||||
virtual void addVehicle(btActionInterface* vehicle) {(void)vehicle;}
|
||||
///obsolete, use removeAction instead
|
||||
virtual void removeVehicle(btActionInterface* vehicle) {(void)vehicle;}
|
||||
///obsolete, use addAction instead.
|
||||
virtual void addCharacter(btActionInterface* character) {(void)character;}
|
||||
///obsolete, use removeAction instead
|
||||
virtual void removeCharacter(btActionInterface* character) {(void)character;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //BT_DYNAMICS_WORLD_H
|
||||
|
||||
@@ -19,15 +19,13 @@
|
||||
#include "btVehicleRaycaster.h"
|
||||
#include "btWheelInfo.h"
|
||||
#include "LinearMath/btMinMax.h"
|
||||
|
||||
|
||||
#include "LinearMath/btIDebugDraw.h"
|
||||
#include "BulletDynamics/ConstraintSolver/btContactConstraint.h"
|
||||
|
||||
static btRigidBody s_fixedObject( 0,0,0);
|
||||
|
||||
btRaycastVehicle::btRaycastVehicle(const btVehicleTuning& tuning,btRigidBody* chassis, btVehicleRaycaster* raycaster )
|
||||
: btTypedConstraint(VEHICLE_CONSTRAINT_TYPE),
|
||||
m_vehicleRaycaster(raycaster),
|
||||
:m_vehicleRaycaster(raycaster),
|
||||
m_pitchControl(btScalar(0.))
|
||||
{
|
||||
m_chassisBody = chassis;
|
||||
@@ -704,6 +702,36 @@ void btRaycastVehicle::updateFriction(btScalar timeStep)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void btRaycastVehicle::debugDraw(btIDebugDraw* debugDrawer)
|
||||
{
|
||||
|
||||
for (int v=0;v<this->getNumWheels();v++)
|
||||
{
|
||||
btVector3 wheelColor(0,255,255);
|
||||
if (getWheelInfo(v).m_raycastInfo.m_isInContact)
|
||||
{
|
||||
wheelColor.setValue(0,0,255);
|
||||
} else
|
||||
{
|
||||
wheelColor.setValue(255,0,255);
|
||||
}
|
||||
|
||||
btVector3 wheelPosWS = getWheelInfo(v).m_worldTransform.getOrigin();
|
||||
|
||||
btVector3 axle = btVector3(
|
||||
getWheelInfo(v).m_worldTransform.getBasis()[0][getRightAxis()],
|
||||
getWheelInfo(v).m_worldTransform.getBasis()[1][getRightAxis()],
|
||||
getWheelInfo(v).m_worldTransform.getBasis()[2][getRightAxis()]);
|
||||
|
||||
//debug wheels (cylinders)
|
||||
debugDrawer->drawLine(wheelPosWS,wheelPosWS+axle,wheelColor);
|
||||
debugDrawer->drawLine(wheelPosWS,getWheelInfo(v).m_raycastInfo.m_contactPointWS,wheelColor);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result)
|
||||
{
|
||||
// RayResultCallback& resultCallback;
|
||||
@@ -727,3 +755,4 @@ void* btDefaultVehicleRaycaster::castRay(const btVector3& from,const btVector3&
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
class btDynamicsWorld;
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
#include "btWheelInfo.h"
|
||||
#include "BulletDynamics/Dynamics/btActionInterface.h"
|
||||
|
||||
class btVehicleTuning;
|
||||
|
||||
///rayCast vehicle, very special constraint that turn a rigidbody into a vehicle.
|
||||
class btRaycastVehicle : public btTypedConstraint
|
||||
class btRaycastVehicle : public btActionInterface
|
||||
{
|
||||
|
||||
btAlignedObjectArray<btVector3> m_forwardWS;
|
||||
@@ -74,12 +75,23 @@ public:
|
||||
virtual ~btRaycastVehicle() ;
|
||||
|
||||
|
||||
///btActionInterface interface
|
||||
virtual void updateAction( btCollisionWorld* collisionWorld, btScalar step)
|
||||
{
|
||||
updateVehicle(step);
|
||||
}
|
||||
|
||||
|
||||
///btActionInterface interface
|
||||
void debugDraw(btIDebugDraw* debugDrawer);
|
||||
|
||||
const btTransform& getChassisWorldTransform() const;
|
||||
|
||||
btScalar rayCast(btWheelInfo& wheel);
|
||||
|
||||
virtual void updateVehicle(btScalar step);
|
||||
|
||||
|
||||
void resetSuspension();
|
||||
|
||||
btScalar getSteeringValue(int wheel) const;
|
||||
@@ -175,27 +187,6 @@ public:
|
||||
m_indexForwardAxis = forwardIndex;
|
||||
}
|
||||
|
||||
virtual void buildJacobian()
|
||||
{
|
||||
//not yet
|
||||
}
|
||||
|
||||
virtual void getInfo1 (btConstraintInfo1* info)
|
||||
{
|
||||
info->m_numConstraintRows = 0;
|
||||
info->nub = 0;
|
||||
}
|
||||
|
||||
virtual void getInfo2 (btConstraintInfo2* info)
|
||||
{
|
||||
btAssert(0);
|
||||
}
|
||||
|
||||
virtual void solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
|
||||
{
|
||||
(void)timeStep;
|
||||
//not yet
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user