Hello,

yesterday I build a new routine for fighting collisions.
But something is wrong with it, when I am in the radius of the monster, in some position I hit it never, in another position I hit it always no matter how I rotate.

I guess I did something wrong here.

Code:
function TForm1.fightcollide(spriteself: TDJXEngineItem): boolean;
var i: integer;
    colSpr: TDJXEngineItem;
    ColPt: TD3DXVector2;
    tmpVec: TD3DXVector2;
    ndist,nrot:  Double;
    vdir,v: TD3DXVector3;
    d: single;
begin
  result:=false;
  nrot:=degtorad(spriteself.nrotatey);
  vDir := D3DXVector3(cos(nrot),0,sin(nrot));
  for i:=0 to Engine.Count-1 do begin
    ndist:=distance_dbl(spriteself.x,spriteself.z,0,Engine.Sprites[i].X,Engine.Sprites[i].Z,0);
    if &#40;Engine.Sprites&#91;i&#93;<>spriteself&#41;
    and &#40;ndist<Innomsprite&#40;spriteself&#41;.nRadius*2+Innomsprite&#40;Engine.Sprites&#91;i&#93;&#41;.nRadius*2&#41;
    then begin
      colSpr&#58;=Engine.Sprites&#91;i&#93;;
      //Player hits Monster
      if &#40;spriteself.name='spieler'&#41; and &#40;meshplayer&#40;spriteself&#41;.status=schlag1&#41; then begin
        if &#40;colspr.name='innom'&#41; and &#40;meshinnom&#40;colspr&#41;.status<>schmerz&#41; then begin
      	  D3DXVec3Subtract&#40;v,D3DXVector3&#40;colspr.X,colspr.Y,colspr.Z&#41;,D3DXVector3&#40;spriteself.X,spriteself.Y,spriteself.Z&#41;&#41;;
          d&#58;= &#40;v.x * vdir.x&#41; + &#40;v.z * vdir.z&#41;;
          d &#58;= ArcCos&#40;d&#41;;
          //if &#40;d <pi> 3*pi/4&#41; then begin //player is in the front area
          if &#40;d <pi> 2*pi/3&#41; then begin //player is in the front area
            meshinnom&#40;colspr&#41;.nanimpos&#58;=0;
            meshinnom&#40;colspr&#41;.status&#58;=schmerz;
            meshinnom&#40;colspr&#41;.hit&#40;meshplayer&#40;spriteself&#41;.nhitpower&#41;;
          end;
        end;
      end;
    end;
  end;
end;
Player is here spriteself, the monster is here the Engine item ColSpr.
I just changed the angle a bit for testing purposes but still the same, it depends on the position not on the rotation right now.

My rotation is a bit strange. When turning around I decrease it, I start at 0, at around -7 I am rotatet one time etc, at -14 two times.

When I render with -nrotatey-pi/2 for Y Rotation it is alright.
So much to my nrotateY.

Firle