[Plugin] jcw_trace (raycast)

Post your work in progress addons and get feedback

Post » Mon Jan 23, 2017 12:20 pm

Johncw87 wrote:
Zebbi wrote:@Johncw87 Is it possible to pick a single instance to trace? I have two tilemap duplicates, one created at runtime, for handling solids differently to the background tiles, and the minute that is created, the tracer sees all the tiles as obstacles. Can I just have the tracer use the instance with the solid tiles removed?


If you are using the plugin in 'Solid' mode, it will ignore any instances where the 'Solid' behavior is disabled. But why are you using the same tiles in the foreground and in the background? Don't you think that would get confusing?


It's for tiles that are non solid and tiles that are solid, can't have both on he same tilemap so I had to duplicate. Actually, ray cast doesn't ignore a seperate instance of the same object that has different solid settings, I tried for hours over the weekend, picking instances of the tilemap, delaying functions to debug the problem and if I have a second tilemap instance of the same object, this time with the solids disabled, it instantly adds all of the new tiles to the tracer.
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Mon Jan 23, 2017 12:47 pm

Zebbi wrote:*quote snip*

It's for tiles that are non solid and tiles that are solid, can't have both on he same tilemap so I had to duplicate. Actually, ray cast doesn't ignore a seperate instance of the same object that has different solid settings, I tried for hours over the weekend, picking instances of the tilemap, delaying functions to debug the problem and if I have a second tilemap instance of the same object, this time with the solids disabled, it instantly adds all of the new tiles to the tracer.


I just tested it, and it works fine.

https://dl.dropboxusercontent.com/u/207 ... lemap.capx

This is the same test project shown in the OP, but with a second instance of the tilemap. This second instance has 4 tiles, none of which affect the reflecting laser due to its 'Solid' behavior being disabled.
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Mon Jan 23, 2017 1:50 pm

Johncw87 wrote:
Zebbi wrote:*quote snip*

It's for tiles that are non solid and tiles that are solid, can't have both on he same tilemap so I had to duplicate. Actually, ray cast doesn't ignore a seperate instance of the same object that has different solid settings, I tried for hours over the weekend, picking instances of the tilemap, delaying functions to debug the problem and if I have a second tilemap instance of the same object, this time with the solids disabled, it instantly adds all of the new tiles to the tracer.


I just tested it, and it works fine.

https://dl.dropboxusercontent.com/u/207 ... lemap.capx

This is the same test project shown in the OP, but with a second instance of the tilemap. This second instance has 4 tiles, none of which affect the reflecting laser due to its 'Solid' behavior being disabled.

Here's an example, sorry I used 5 traces, it's just for a experiment, but as you can see, the second instance with the solids disabled still affects the trace: https://www.dropbox.com/s/0p6rkii91i8e4 ... .capx?dl=0
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Tue Jan 24, 2017 3:46 am

Zebbi wrote:*quote snip*

Here's an example, sorry I used 5 traces, it's just for a experiment, but as you can see, the second instance with the solids disabled still affects the trace: https://www.dropbox.com/s/0p6rkii91i8e4 ... .capx?dl=0


Well, I would like to look at your project, but you've got these other plugins in it.
MagiCam
Simulate key event
Platform Plus

While I doubt another plugin is causing a problem, it's still a good idea to keep other 3rd party plugins out of a .capx when you are reporting a bug. But most importantly, I'm lazy and don't want to hunt down and install these plugins :lol:
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Tue Jan 24, 2017 12:40 pm

Johncw87 wrote:
Zebbi wrote:*quote snip*

Here's an example, sorry I used 5 traces, it's just for a experiment, but as you can see, the second instance with the solids disabled still affects the trace: https://www.dropbox.com/s/0p6rkii91i8e4 ... .capx?dl=0


Well, I would like to look at your project, but you've got these other plugins in it.
MagiCam
Simulate key event
Platform Plus

While I doubt another plugin is causing a problem, it's still a good idea to keep other 3rd party plugins out of a .capx when you are reporting a bug. But most importantly, I'm lazy and don't want to hunt down and install these plugins :lol:

Sorry, forgot about those! Here's a cleaned version: https://www.dropbox.com/s/62rf3cy1y7ukn ... .capx?dl=0

As you see with the delayed function, the added instance causes the tracer to find the obstacles.
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Tue Jan 24, 2017 11:20 pm

The plugin draws a (virtual) line from start point to end point. (you dont need to actual draw that line)
When that line intersects with an 'obstacle', the expressions Trace.HitX & Trace.HitY will hold the exact coordinates of that intersection.
Trace.UID will hold the UID of that obstacle.
So, yes, it detects obstacles only.
Where 'obstacles' is the description that the author of the plugin gave to what you would like to see named as 'targets', i understand.
The plugin (although based on) is not a Line-of-sight detector, it is basically the opposite.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jan 25, 2017 12:31 am

99Instances2Go wrote:The plugin draws a (virtual) line from start point to end point. (you dont need to actual draw that line)
When that line intersects with an 'obstacle', the expressions Trace.HitX & Trace.HitY will hold the exact coordinates of that intersection.
Trace.UID will hold the UID of that obstacle.
So, yes, it detects obstacles only.
Where 'obstacles' is the description that the author of the plugin gave to what you would like to see named as 'targets', i understand.
The plugin (although based on) is not a Line-of-sight detector, it is basically the opposite.

Don't worry, it works fine for what I need it for, I just can't get it work with that particular tilemap setup, I've updated my project and you can see the second instance interrupts the tracer when it's loaded.
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Wed Jan 25, 2017 7:01 am

Zebbi wrote:
Johncw87 wrote:
Zebbi wrote:*quote snip*

Here's an example, sorry I used 5 traces, it's just for a experiment, but as you can see, the second instance with the solids disabled still affects the trace: https://www.dropbox.com/s/0p6rkii91i8e4 ... .capx?dl=0


Well, I would like to look at your project, but you've got these other plugins in it.
MagiCam
Simulate key event
Platform Plus

While I doubt another plugin is causing a problem, it's still a good idea to keep other 3rd party plugins out of a .capx when you are reporting a bug. But most importantly, I'm lazy and don't want to hunt down and install these plugins :lol:

Sorry, forgot about those! Here's a cleaned version: https://www.dropbox.com/s/62rf3cy1y7ukn ... .capx?dl=0

As you see with the delayed function, the added instance causes the tracer to find the obstacles.


Well, the problem is clear as day! Remember what I said before?

Johncw87 wrote:If you are using the plugin in 'Solid' mode, it will ignore any instances where the 'Solid' behavior is disabled.


That only applies for 'Solid' obstacle mode. It doesn't work in 'Custom' obstacle mode.
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Wed Jan 25, 2017 7:59 am

Johncw87 wrote:
Johncw87 wrote:
Zebbi wrote:*quote snip*

Here's an example, sorry I used 5 traces, it's just for a experiment, but as you can see, the second instance with the solids disabled still affects the trace: https://www.dropbox.com/s/0p6rkii91i8e4 ... .capx?dl=0


Well, I would like to look at your project, but you've got these other plugins in it.
MagiCam
Simulate key event
Platform Plus

While I doubt another plugin is causing a problem, it's still a good idea to keep other 3rd party plugins out of a .capx when you are reporting a bug. But most importantly, I'm lazy and don't want to hunt down and install these plugins :lol:

Sorry, forgot about those! Here's a cleaned version: https://www.dropbox.com/s/62rf3cy1y7ukn ... .capx?dl=0

As you see with the delayed function, the added instance causes the tracer to find the obstacles.


Well, the problem is clear as day! Remember what I said before?

Johncw87 wrote:If you are using the plugin in 'Solid' mode, it will ignore any instances where the 'Solid' behavior is disabled.


That only applies for 'Solid' obstacle mode. It doesn't work in 'Custom' obstacle mode.

Ahh, so is there a way of sorting it out so I can have a second instance of the tilemap (for backgrounds) with solids disabled and not trigger the trace?
B
41
S
12
G
14
Posts: 1,122
Reputation: 11,268

Post » Wed Jan 25, 2017 9:46 am

Zebbi wrote:*quote snip*

Ahh, so is there a way of sorting it out so I can have a second instance of the tilemap (for backgrounds) with solids disabled and not trigger the trace?


No. This is also unlikely to change, as having the Solid behavior continue to have an influence after switching it to custom seems arbitrary. Code-wise, I would either have to used an optimized method that might break in future construct versions, or perform a second search through an already filtered list. I'm not really fond of either solution.

IMO, this problem of yours highlights the Tilemap plugin's inability to mark a tile as having no collision. Though the Tilemap plugin has improved significantly since its initial release, these sorts of shortcomings are why I don't use it in my projects.
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

PreviousNext

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests