What i noticed is that the first collision iteration of raycast (even if not in collision) is always positive while it should not.
It means that every condition to check if player is hit before getting close is always positive…and at the enemy creation they will see u anyway no matter what (or obstacles). (Like getting hit from behind a wall in Dark Souls :))
Asking if possible for a fix…simply because at an enemy creation, if laser is not hitting something, collision should not happen.
Anyway i’m asking you opinion on the matter.
I may be wrong but i remember this to works in v 5.2
Thx in advance
operation:
start the game player is hit but laser is not hitting.
you can drag black box with mouse to check collisions
u may need to get enough close to check later collisions cos i’ve volountairly reduced the lenght
EDIT: also later collisions are bad calculated, because they should not happen above laser lenght.
In the end i guess raycast collisions needs a total rework
A possible fix would be to cast the laser at declared lenght and fix the first collision
The ray cast is fine. Shape painter collision uses the bounding box not the lines. When your project starts, the variables are at their default value of 0. So, it draws a line to the top, left corner. The shape painter’s hit box is almost the size of the scene. You can use the draw collisions and hitboxes to see the hitboxes. Collisions with a shape painter
I need this to chase p1 so the angle is constantly updated, i understand your second screenshot, but to me it’s not like a laser should work, if the laser is drawn by the shape painter collision boxes, it means that for example if the player is between the two enemies there is no way to avoid the collision. Thaz kinda stupid imo.
There is no point to use the laser if it works like this. It looks like the same as Square distance calculation, (but bad).
Still thanks for the clarification
If you want it more like a trip wire than targeting it then you could cast a ray in between the lasers and use the player as the test object. Or set the left object to test towards 0 degrees and the right to 180. You could rotate the objects and use their angle for the ray cast angle or use an object variable for the direction,
I’m gonna test it. Thx .
But at the moment i’m more oriented to use di distance between condition since it’s basically the same thing, but less complicated
This way you can check laser collisions without issues for each instance,
The most important is the prevent laser cast condition.
It works so flawlessly now, that i’m crying.