zerochen wrote:hi,
bullet obj deactivate after a few seconds so you must active them explicit or disable the deactivation
eg
- cpp Code: Select all
body->setActivationState(EAS_DISABLE_DEACTIVATION)
Thanks it works
zerochen wrote:hi,
bullet obj deactivate after a few seconds so you must active them explicit or disable the deactivation
eg
- cpp Code: Select all
body->setActivationState(EAS_DISABLE_DEACTIVATION)
void CCylinderShape::createShape()
{
node->updateAbsolutePosition();
const core::vector3df& extent = node->getBoundingBox().getExtent();
shape = new btCylinderShape(irrlichtToBulletVector(extent * 0.5));
shape->setLocalScaling(irrlichtToBulletVector(node->getScale()));
calculateLocalInertia(mass, core::vector3df(0.0f,0.0f,0.0f));
}
rigidBody->setAngularFactor(vector3df(0,1,0));
C:\Users\Person\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp||In function 'int main()':|
C:\Users\Person\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp|54|error: expected type-specifier before 'CCylinderShape'|
C:\Users\Person\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp|54|error: cannot convert 'int*' to 'ICollisionShape*' in initialization|
C:\Users\Person\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp|54|error: expected ',' or ';' before 'CCylinderShape'|
||=== Build finished: 3 errors, 3 warnings ===|#include <ISceneNode.h>
#include "Bullet/btBulletDynamicsCommon.h"
#include "Bullet/btBulletCollisionCommon.h"
#include "cylindershape.h"
using namespace irr;
using namespace core;
using namespace scene;
CCylinderShape::CCylinderShape(ISceneNode* const n, f32 m, bool overrideMargin)
{
node = n;
mass = m;
type = ECST_BOX;
createShape(overrideMargin);
}
void CCylinderShape::createShape()
{
node->updateAbsolutePosition();
const vector3df& extent = node->getBoundingBox().getExtent();
shape = new btCylinderShape(irrlichtToBulletVector(extent * 0.5));
setLocalScaling(node->getScale(), ESP_COLLISIONSHAPE);
calculateLocalInertia(mass, vector3df(0.0f,0.0f,0.0f));
}
CCylinderShape::~CCylinderShape()
{
}
// Copyright (C) 2009-2011 Josiah Hartzell (Skyreign Software)
// This file is part of the "irrBullet" Bullet physics extension library and wrapper.
// For conditions of distribution and use, see license in irrbullet.h
// The above copyright notice and its accompanying information must remain here.
#ifndef __CYLINDER_SHAPE_H_INCLUDED__
#define __CYLINDER_SHAPE_H_INCLUDED__
#include "collisionshape.h"
class CCylinderShape : public ICollisionShape
{
public:
CCylinderShape(irr::scene::ISceneNode* const n, irr::f32 m, bool overrideMargin = false);
virtual ~CCylinderShape();
protected:
void createShape(bool overrideMargin);
};
#endif // __CYLINDER_SHAPE_H_INCLUDED__
ICollisionShape *playershape = new CCylinderShape(player, 1, false);#include "CCylinderShape.hICollisionShape *Floorshape = new CCylinderShape(Floor, 0, false);C:\Users\Stijn\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp|69|undefined reference to `CCylinderShape::CCylinderShape(irr::scene::ISceneNode*, float)'|ICollisionShape *Floorshape = new CCylinderShape(Floor, 0);ICollisionShape *Floorshape = new CCylinderShape(Floor, 0,false);C:\Users\Stijn\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp||In function 'int main()':|
C:\Users\Stijn\Documents\Irrlicht\irrlicht-1.7.2\examples\01.HelloWorld\main.cpp|69|error: no matching function for call to 'CCylinderShape::CCylinderShape(irr::scene::ISceneNode*&, int, bool)'|
C:\Users\Stijn\Documents\Irrlicht\irrBullet-0.1.8\source\cylindershape.h|15|note: candidates are: CCylinderShape::CCylinderShape(irr::scene::ISceneNode*, irr::f32)|
C:\Users\Stijn\Documents\Irrlicht\irrBullet-0.1.8\source\cylindershape.h|13|note: CCylinderShape::CCylinderShape(const CCylinderShape&)|
||=== Build finished: 1 errors, 3 warnings ===|
also after that you have to recompile the irrbullet.lib
Users browsing this forum: No registered users and 1 guest