Jump to content
Sign in to follow this  
F.hao

Suddenly i found the Raycast will Hit nothing,if the start position in the Entity's inside

Recommended Posts

RaycastInnerCube.png.99b1023c63fa1559f45c9345c4d17c5f.png

Like this, if the  Raycast Line start mushroom's postion, to the direction(0,0,1), then there is nothing can be hit.

So does this is a bug? Or maybe i want know why?

Share this post


Link to post
Share on other sites

@F.hao

Hey

1) Have you checked to make sure collision is on for all objects?

2) Have you checked the distance of the raycast? If your raycast distance is too far it will not work.

3) Raycast inside (or beside an object) might cause it to immediately "hit"? Have you tried using a console text that prints the hit position?

 

Edited by Igor Q.

Share this post


Link to post
Share on other sites
On 7/8/2022 at 9:37 AM, Igor Q. said:

@F.hao

Hey

1) Have you checked to make sure collision is on for all objects?------Yes, Collision is enabled.

2) Have you checked the distance of the raycast? If your raycast distance is too far it will not work.---------I have test different distance, and i didn't find raycast to be invalid.so i think the length is not a problem.

3) Raycast inside (or beside an object) might cause it to immediately "hit"? Have you tried using a console text that printa the hit position?-----Yes i always text with console. And my ways is use a Entity's postion & axis_Z direction to fire a raycast. But once put the entity  into another object, the raycast will

 

Hi Igor.Q Sorry for so late to reply.

I test again and here is my .yland. The answer is same, if you can check it.

RAYCASTSHOT.zip

Share this post


Link to post
Share on other sites

847814153_Snmkaobrazovky(447).thumb.png.f505ceaad6316c39bca0b4b990d5d87a.png309822462_Snmkaobrazovky(446).thumb.png.6796d4ff2930e11381f57e7ee60069d9.png

for me,it works good.
entity 1 = mushroom position Y 0.375 
entity 2= mushroom position Y 0.255
everytime hit correct target ,collisions ON

Edited by Mello1223

Share this post


Link to post
Share on other sites
6 hours ago, Mello1223 said:

 

for me,it works good.
......

Oh,Yes, for now i think raycast is work good. I think i make a misunderstanding. The point is: if the Begin position in another Object's body, then the raycast will ignore Object-self and keep going forward (before our test, i just thought it will hit Object-self). and @Igor Q. Everything is clear now.

By the way ,i found this problem because i'm trying make a function to let my AI-bot move in the ground, and there is some Entity to block road.

The origin idea is just found a position by raycast, and AI can go to the position. But then i found if my AI walk into the Entity, caused by some rotate event, like if AI near the wall,and suddenly rotate, then it will enter the wall, and once they already be in the wall, the raycast will not use. It will never help me found a right position to go.

And yes, i know this is not a Complete function, So at last, i choose bfs to find a road.😆

  • Upvote 1

Share this post


Link to post
Share on other sites

Hi,

colliders on objects have just one side active. In most cases it is enough and you can have half of active "colliders". If you want to hit also object itself than I would suggest to use Overlap sphere script tile with really small radius.

  • Upvote 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×