dot between normal point and direction object

I have to check in a gameobject and a plan that the normal of the plane is equal to the direction “up” the game object. How can I do? this is what I’m doing.

    void Update () 
    {
        RaycastHit hit;
        if(Physics.Raycast(this.transform.position, Vector3.down,out hit, 5.0f))
        {
            Debug.DrawLine(this.transform.position, hit.point, Color.red);
            Debug.DrawLine(hit.point, hit.point+hit.normal, Color.blue);
            Debug.DrawLine(this.transform.position, this.transform.position+Vector3.up, Color.black);
            if(Mathf.Approximately(Vector3.Dot(this.transform.up,hit.normal),1)==false)
            {
                plane.transform.Rotate(-0.5f, 0, 0);
            }

        }
    }

OK, yes, if the dot product of 2 unit vectors is 1 (using approximately for float error), than the vectors are in the same direction.

What’s the problem you’re having??? Is it with the rest of your code? What are you trying to do?

I’m trying to make a way that an object to follow a path (path made up of plans) and must follow the different angles without the use of physical

Are you trying to have ‘plane’ stand straight up on the surface that it’s standing on? So that it’s up vector equals that of the surface it’s on?

So you’ll want to maintain the same general forward direction, but use this new up.

Well you can use cross products for that. If we take the cross product of the current forward with the desired up, we’ll get a vector that is orthogonal (perpendicular in 3-space) to the forward and up. Then if we take the cross of that with the desired up, we get the orthogonal of that which would be the new desired forward that is orthogonal to up.

Now if we stick that into the Quaterion.LookRotation, we get the rotation we desire:

        var n = *the up we desire, from the normal*;
        var f = plane.transform.forward;
        f = Vector3.Cross(Vector3.Cross(n, f), n);
        var rot = Quaternion.LookRotation(f, n);
        plane.transform.rotation = rot;

If you want to ease towards this new rotation, use Quaternion.Slerp:

        var n = *the up we desire, from the normal*;
        var f = plane.transform.forward;
        f = Vector3.Cross(Vector3.Cross(n, f), n);
        var rot = Quaternion.LookRotation(f, n);
        plane.transform.rotation = Quaternion.Slerp(plane.transform.rotation, rot, 0.5f);