I have trouble of understanding world space vs local space in my LineRenderer and EdgeCollider2D components.
I have a player GO with attached LineRenderer and EdgeCollider2D to it. I have a helper variable to store my moves as a following list:
private List<Vector3> _moveLinePoints;
Then in my update method I’m filling player’s position as following:
Then I set up my line renderer with those points and also my edge collider:
_lineRenderer.positionCount = _moveLinePoints.Count; _lineRenderer.SetPositions(_moveLinePoints.ToArray()); var vector2Points = _moveLinePoints .Select(point => new Vector2(point.x, point.y)) .ToList(); _edgeCollider.points = vector2Points.ToArray();
My line renderer has useWorldSpace set to true because if it’s not it has some strange offset (so I assume that
playerPosition.position are world coordinates, right?)
When I run my game I see Liner Renderer with correct position and my collider with wrong position:
How can I change my EdgeCollider points to be world space related?