Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback Can Unity fix the Unicode issues on

Discussion in 'General Discussion' started by TiggyFairy, Feb 12, 2023.

Thread Status:
Not open for further replies.
  1. TiggyFairy


    Dec 22, 2019
    460 seems like a really useful site, and I don't actually know if it's officially affiliated with Unity. However, there is a massive problem with the unicode or something like it on the site that is rendering vast chunks of text as:
    . It's driving me up the wall as I can find a solution to my issue very easily on there, but I can't read it.

    Sorry if this is the wrong forum.
  2. Murgilod


    Nov 12, 2013
    It's being worked on and is "high priority."

  3. Ryiah


    Oct 11, 2012
    ChatGPT can though it does lose the formatting in the process.

    Sure, here's the corrected text:

    Truth be told, the easiest and best way to do this is by using multiple colliders. Check which collider you hit, and react based on that.

    If you really must inspect the collision details, you can use an overload of raycast that populates RaycastHit data, including the point of impact.

    I'll assume we have this data populated by raycast call:

    RaycastHit hit; You said we have a BoxCollider?

    BoxCollider box = hit.collider as BoxCollider; if (box == null) Debug.LogWarning("Collider is not a BoxCollider!"); Let's convert our collision point to local space:

    Vector3 localPoint = hit.transform.InverseTransformPoint(hit.point); Vector3 localDir = localPoint.normalized; This gives us a point relative to the box collider itself.

    Is the point above or below the box? To the right or the left? In front or behind? We can use dot products to find out.

    float upDot = Vector3.Dot(localDir, Vector3.up); float fwdDot = Vector3.Dot(localDir, Vector3.forward); float rightDot = Vector3.Dot(localDir, Vector3.right); In this example, the dot product tells us if two vectors are pointing in similar directions. You'll get -1 if they're pointing exactly opposite, 0 if they're exactly perpendicular, or 1 if they're exactly parallel.

    Our point might be slightly above the box, and far to the right of it. These dot products tell us how far the point has moved in any of those three directions.

    (In case you're wondering, the value is equal to the sine of the angle between the two vectors.)

    If upDot is positive, we're above the box; if negative, we're below the box.

    If fwdDot is positive, we're in front of the box; if negative, we're behind the box.

    If rightDot is positive, we're to the box's right; if negative, we're to its left.

    We can find out which direction is pointing furthest by comparing their absolute value:

    float upPower = Mathf.Abs(upDot); float fwdPower = Mathf.Abs(fwdDot); float rightPower = Mathf.Abs(rightDot); If upPower is the largest, we're mostly above or below the box.

    If fwdPower is the largest, we're mostly in front of or behind the box.

    If rightPower is the largest, we're mostly to the left or right of the box.

    Combine these two discoveries, and you'll know which side of the box you hit.

    Alternatively you can just use a text editor to replace "$$anonymous$$" with "hi".
    Last edited: Feb 13, 2023
  4. Antypodish


    Apr 29, 2014
    Ryiah and zombiegorilla like this.
  5. zombiegorilla



    May 8, 2012
    Please search first. Closed.
Thread Status:
Not open for further replies.