grokko
Could you show me a quick positive Raycast to an Octree Component Terrain Node *?
My raycasts work for other creatures(‘n’ of them’) but never for the Terrain…
MS
indent preformatted text by 4 spaces
if(diffTime>dalekI->firingTime) {
Vector3 myPos = -dalekI->getNode()->GetPosition();
Vector3 dir = cameraNode_->GetPosition() + myPos;
dir.Normalize();
dalekI->ray1 = Ray(myPos, dir);
PODVector<RayQueryResult> results;
RayOctreeQuery query(results, dalekI->ray1, RAY_TRIANGLE, 2000, DRAWABLE_GEOMETRY);
scene_->GetComponent<Octree>()->RaycastSingle(query);
if (results.Size()) {
RayQueryResult& result = results[0];
Node * hit = result.node_;
if((Node *)terrainNode == hit) {
dalekI->boolShot = false;
logMe2("DALEK FIRED at terrainB!!!!", i, i);
} else {
dalekI->boolShot = true;
logMe2("DALEK didn't FIRED at terrainB!!!!", i, i);
}
} else {
dalekI->boolShot = true;
}
if(dalekI->boolShot) makeMeAnotherMissile(dalekI, scene_, i);
lastTime = nowTime;
dalekI->firingTime = (rand() % 4000) + 2000;
((CDalek *)dalekI)->myTimer->Reset();
Blockquote