Seems like a simple task..

It seems like a simple task, you need to determine whether the horse is under the saddle or not, but no matter how hard I tried, I still couldn’t understand how this is done, here is my code for the forum:

RaycastHit hit;
if (UnityEngine.Physics.Raycast(player.eyes.HeadRay(), out hit))
{
    BaseEntity entity = hit.GetEntity();

    var myhorse = entity.GetComponent<RidableHorse>();

    if (entity != null && entity.name.Contains("testridablehorse"))
    {
        if (int.Parse(dataFile["Horses"].ToString()) <= 61)
        {
            entity.Kill();
        }
    }
}

what are you mean , bro

well, it's quite hard to determine what did you try to do here.

You are not quite checking under, you are checking Head Ray :)

Is it that you are trying to kill the horse as soon as player gets on it?

RaycastHit попадание ; 
если  ( UnityEngine . Physics . Raycast ( player.eyes.HeadRay ( ) , из удара ) ) { BaseEntity 
    сущность = hit .​​​ ПолучитьEntity ( ) ; вар HorseMountable = сущность . GetComponent <RidableHorse> ( ) ;​​ if ( entity ! = null && entity.name.Содержит ( " testridablehorse " ) && horseMountable.HasSaddle ( ) )​​​ 

    
        
        
    {
    
            сущность . Убить ( ) ; 
            PrintToChat ( плеер ,  «Спасение лошади» ) ; 
    } 
}
XpBhmpUR6sHBukC.jpg AVOCoder

what are you mean , bro

I solved this problem