Hi folks!
I trying to create something like hitBox for my BigBot and it’s work with visible other static geometry in hitBox-node, but if i turn off static model it not work.
node still have Collision Shape & Rigidbody but raycast with (DRAWABLE_ANY) return false.
hitBox is a child-node of some bone in Skeleton
it has Rigidbody(mass 0) and CollisionShape(Capsule shape) and StaticModel with std : Cylinder model
also i’m set var for this node “tag” with value “hitbox” for Raycast sorting
bool Character::RaycastAnyByTag(String tag, float maxDistance, Vector3& hitPos, Vector3& hitNormal, Drawable*& hitDrawable)
{
hitDrawable = 0;
Node* gunNode_ = nodeGuns_->GetChild("JointFireFx", true);
Ray gunRay = Ray(gunNode_->GetWorldPosition(), nodeGuns_->GetWorldDirection());
PODVector<RayQueryResult> results;
RayOctreeQuery query(results, gunRay, RAY_TRIANGLE, maxDistance, DRAWABLE_ANY, -1); // all
//RayOctreeQuery query(results, gunRay, RAY_TRIANGLE, maxDistance, DRAWABLE_GEOMETRY, 191); // all except 7 bit (layer for fx)
Octree* octree = GetScene()->GetComponent<Octree>();
octree->Raycast(query);
if (results.Size())
{
for (unsigned int i = 0; i < results.Size(); i++)
{
RayQueryResult& result = results[i];
Variant fx = result.node_->GetVar("tag");
if (fx.GetString() != tag) continue;
hitPos = result.position_;
hitNormal = result.normal_;
hitDrawable = result.drawable_;
return true;
}
}
return false;
}
in this video as first static model is - on ( hitBox - works), then i turn off it from view (and hitBox not work).
[video]http://www.youtube.com/watch?v=JvVnHyX8zso[/video]
maybe i’m doing something wrong, but how to make hitBox without visible shapes / model for hit ?
Is it possible use for Raycast only CollisionShape w Rigidbody ?