dgiim2
1
[71851-캡처.png|71851]
As above image, small red box is the Bound’s ‘min’ point, and magenta box is bound’s ‘max’ point.
but i need to know actual bottom point of these cars in programmatically.
for example, in above case, a points which around of right side of front bumper of each cars.
how do i know that?
1 Answer
1
well your question isn’t very clear… Is this for Collider2D use?
I guess :
[RequireComponent(Collider2D)]
[RequireComponent(Rigidbody2D)]
public class car : Monobehaviour
{
private Collider2D _collider;
private RigidBody2D _body;
private Vector2 min;
private Vector2 max;
void Start()
{
_collider = getComponent<Collider2D>();
_body = getComponent<RigidBody2D>();
min.x = _body.position.x - _collider.bounds.extents.size.x / 2;
min.y = _body.position.y - _collider.bounds.extents.size.y / 2;
max.x = _body.position.x + _collider.bounds.extents.size.x / 2;
max.y = _body.position.y + _collider.bounds.extents.size.y / 2;
}
}
thanks. it's a very helpful to me.
– dgiim2