position transformations
I have a function that outputs the positions of several points that I use to connect lines to. Each line is its own gameobject, initially the calculation of the positions works great. But I parented...
View ArticleConsistent World Transformation of Collider Point
I'm trying to get accurate world coordinates for a certain local point of an object's box collider (say, the bottom rear right corner when facing +z). I've used the following implementation in a script...
View ArticleDistributing agents over an area
Hello, I have multiple agents (hundreds) in my scene, heading to different areas. An area is a GameObject with a cube and a mesh renderer, material is translucent. At start each agent have one (random...
View ArticleWhy transform.TransformPoint(transform.position) prints differently than...
From a script attached on an object, which actually casts a Linecast from itself to a "target" object, I instruct to print the following two statements: print...
View ArticleComparing World Positions
So I've been trying to find the closest node to a certain object: void FindClosestNode (Transform comparitive) { float closeDistance = Mathf.Infinity; GameObject closestNode = null; GameObject[] gNodes...
View ArticleChange vertex's world position
Hi, I'm trying to create bumps on my mesh. To do so, I have to tell every vertex of my mesh to change its "y" value. It worked fine, when I had one mesh. The problem started when I created chunks. So...
View ArticleElegantly flattening a relative vector
Vector3 zed = other.transform.InverseTransformVector (transform.position - other.transform.position); zed .x = 0f; zed .y = 0f; zed = other.transform.position + other.transform.TransformVector (zed);...
View ArticleVersion of Transform.TransformPoint which is unaffected by scale?
Is there a scale-independent version of Transform.TransformPoint? I am trying to convert a position to a localized position relative to an object, and then round that position. The problem is that with...
View ArticleHaving trouble with the transform.TransformPoint function
Here's my code: RHS = transform.TransformPoint(2, 0, 0); Debug.DrawRay(transform.position, RHS, Color.blue, 20); When I ran this, I expected to get a line drawn from the gameObject's transform directly...
View Articletransform.transformpoint not returning correct value
Like the title says, transform.transformpoint isn't returning the correct value. For some values of the variable point, it's off by a little, some it's off by a lot. foreach (PolygonCollider2D col in...
View ArticleCan someone please explain the difference between TransformPoint and...
I've read a few different posts about this on StackOverflow and the Unity forums, but I still don't understand what's happening with these functions. Let me attempt to briefly explain what I do think I...
View Article