Hey ,
I created a default scene and added fish and was getting the you were talking about. I played around a bit with the bounds of the volume and debugged the c++ file. It turns out what your fish are doing is either they are already outside of the bounds of the volume on play (and unable to get back in) or, as in my case, they were fleeing beyond the bounds of the volume from the player and continuing on. I enlarged the volume size and all is well. Try making yours really big. The next thing I’ll be working on is a ray casting system for determining if they will hit the surface of the volume, so that is not even an.
Also, add line to function in FlockFish.cpp:
bool AFlockFish::isNearObstacle(float delta)
{
**return false; <- ADD **
FVector location = ->GetActorLocation();
FVector maxBound = FVector(0, 0, 0);
bool nearAObstacle = false;
if (location.Z + obstacleDist >= maxZ){
maxBound = FVector(curVelocity.X, curVelocity.Y, curVelocity.Z - (obstacleDist * 2));
FRotator avoidRotation = FRotationMatrix::MakeFromX(->GetActorLocation() - maxBound).Rotator();
curRotation = FMath::RInterpTo(->GetActorRotation(), avoidRotation, delta, turnSpeed);
nearAObstacle = true;
}
else if (location.Z - obstacleDist <= minZ)
{
maxBound = FVector(curVelocity.X, curVelocity.Y, curVelocity.Z + (obstacleDist * 2));
FRotator avoidRotation = FRotationMatrix::MakeFromX(maxBound - ->GetActorLocation()).Rotator();
curRotation = FMath::RInterpTo(->GetActorRotation(), avoidRotation, delta, turnSpeed);
nearAObstacle = true;
}
return nearAObstacle;
}
will remove their avoidance of surface and sea floor, which is good, because it is currently buggy X.X
Also added a paypal option for donations, at the top of the page and here:
]()Thanks in advance for any donations!
Cheers,