Hello,
I cannot mannage to find a way to shoot 4 rays with diffrent vector3 from a objects direction (the z axis).
it works find for one direction but when i rotate the object the ray stays in the same direction. What i want is that the direction change based on the rotation.
private Vector3 topLeft = new Vector3(-0.5f,0.5f,1.0f);
private Vector3 topRight = new Vector3(0.5f,0.5f,1.0f);
private Vector3 buttomLeft = new Vector3(-0.5f,-0.5f,1.0f);
private Vector3 buttomRight = new Vector3(0.5f,-0.5f,1.0f);
private int rayHits = 0;
if (Physics.Raycast(transform.position, (transform.forward * topLeft), out hit, wallJumpDistance))
{
rayHits++;
}
if (Physics.Raycast(transform.position, (transform.forward * topLeft), out hit, wallJumpDistance))
{
rayHits++;
}
if (Physics.Raycast(transform.position, (transform.forward * topLeft), out hit, wallJumpDistance))
{
rayHits++;
}
if (Physics.Raycast(transform.position, (transform.forward * topLeft), out hit, wallJumpDistance))
{
rayHits++;
}
Thanks for helping ![]()