[Solved] Warning: You must implement collideSphere

[Solved] Warning: You must implement collideSphere

Hi, I am trying to use hkpSampledHeightFieldShape, but I always get this warning during simulation:

Shape\HeightField\SampledHeightField\hkpSampledHeightFieldShape.cpp(107): [0x4B50036A] Warning: You must implement collideSpheres!

The implementation is:

class MySampledHeightFieldShape : public hkpSampledHeightFieldShape
MySampledHeightFieldShape(const hkpSampledHeightFieldBaseCinfo& ci) : hkpSampledHeightFieldShape(ci) {}
HK_FORCE_INLINE hkReal getHeightAtImpl( int x, int z ) const{ return 0; }
HK_FORCE_INLINE hkBool getTriangleFlipImpl(){ return false; }
virtual void collideSpheres( const CollideSpheresInput& input, SphereCollisionOutput* outputArray) const
hkSampledHeightFieldShape_collideSpheres(*this, input, outputArray);

So, how should I remove warning?

2 帖子 / 0 全新

Hi Sergey,

Looks like you're missing a const in the getTriangleFlipImpl() definition so it isn't overriding the base class definition, it should be "HK_FORCE_INLINE hkBool getTriangleFlipImpl() const". Unfortunately getTriangleFlipImpl() throws throws the same warning as the collideSpheres(...) if it isn't implemented in the child class. I've logged an issue for this as it is quite confusing :)

Amy Developer Support Engineer Havok www.havok.com