- Home /
Use full kinamatic contacts don't work with Physics2D.Raycast Unity 5.5
I have a GameObject with a RigidBody2D marked as Kinematic and a BoxCollider2D with Is Trigger NOT checked. I don't want this object to make part of physics calculations during the loops, because I will control the movements and make collision checks manually on specific situations, using Raycast2D, so I unchecked the "Simulated" checkbox. But I want them to colide with each other, but as they are kinematic rigidbodies, I checked the "Use Full Kinematics Contacts".
With the configuration described, the Raycast2D don't work, the ray overlaps the BoxCollider, but but the RayCast2D returns zero collisions.
If I check the "Simulated" checkbox, it works.
Did I understand it wrong? the "Use Full Kinematics Contacts" really don't work with RayCasting?
private RaycastHit2D ProcessRayCollision(List<Ray2D> ray)
{
for (int i = 0; i < ray.Count; i++)
{
//check all rays
var raycastHit2D = Physics2D.Raycast(ray[i].Origin, ray[i].Direction, rayDistance);
if (raycastHit2D)
{
//Debug.Log("hit: " + raycastHit2D);
return raycastHit2D;
}
}
return new RaycastHit2D();
}
Thanks.
Your answer
Follow this Question
Related Questions
How do I make a rigidbody2d that doesn't do anything on collision? 1 Answer
rotate 2d object without affecting the rigidbody ? 1 Answer
Rigidbody2d starts as kinematic enabled when it is not in inspector 0 Answers
How do I Spawn an Object on a Seafloor Randomly? 0 Answers
Stop player from pushing tilemap 1 Answer