[Plugin] jcw_trace (raycast)

Post your work in progress addons and get feedback

Post » Mon May 09, 2016 1:48 am

@UberLou

I had saw the source code, it did not have redundant code.

All I could image for performance improving in this plugin are
1. running in webworker, but it will become asynchronous.
2. using asm.js. It might be a better way, except not all environments has asm.js supporting, and it is not easy since developer needs to write C/C++ first.
B
108
S
26
G
259
Posts: 4,432
Reputation: 145,687

Post » Mon May 09, 2016 2:39 am

@rexrainbow Thanks for the reply!
B
79
S
51
G
39
Posts: 370
Reputation: 24,705

Post » Mon May 09, 2016 3:29 am

I've updated the plugin. Line traces now work with tilemaps, but there is currently an issue where flipped tiles will cause the normal to be on the wrong side.

The example has also been updated with a second layout, which contains a tilemap.
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Mon May 09, 2016 4:46 am

Here is a comer case
Image
The normal vector and reflect vector might have trouble while the hit point is at (or nearby) the cross point of collision polygon's two edges. In the above image, the normal/reflect vector is correct for one edge, but the finally result is wrong.
Any hint to correct this case?
B
108
S
26
G
259
Posts: 4,432
Reputation: 145,687

Post » Mon May 09, 2016 5:12 am

rexrainbow wrote:Here is a comer case
Image
The normal vector and reflect vector might have trouble while the hit point is at (or nearby) the cross point of collision polygon's two edges. In the above image, the normal/reflect vector is correct for one edge, but the finally result is wrong.
Any hint to correct this case?


Something I've noticed in other game engines (like Source) is that the trace hit point is never actually on the plane (or line) it hit, but some small distance before it. My plugin is currently giving you the hit point right on the line. Perhaps they add a little space on purpose to avoid exactly this situation?
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Mon May 09, 2016 5:45 am

Thanks, it is a very useful suggestion.

Here is the demo of reflecting using your plugin. (source capx)
I preserve 2 pixels space calculated in event.
It is better to have a property to set the preserved space since user might miss that, but not necessary.
B
108
S
26
G
259
Posts: 4,432
Reputation: 145,687

Post » Mon May 09, 2016 6:15 am

rexrainbow wrote:I preserve 2 pixels space calculated in event.


When I said 'small distance', I meant something more along the lines of less than 0.1 units ;)

I'll add the padding property to my mental to-do list.
B
54
S
19
G
13
Posts: 97
Reputation: 10,146

Post » Mon May 09, 2016 6:24 am

I test preserved space to 0.1, it works well, too. And the result almost the same as preserved space to 2.
Thanks for your help.
B
108
S
26
G
259
Posts: 4,432
Reputation: 145,687

Post » Mon May 09, 2016 10:40 am

Hey, great plugin. Thanks for sharing.
I made an icon you can use if you like it. icon
B
68
S
28
G
7
Posts: 85
Reputation: 7,496

Post » Mon May 09, 2016 11:01 am

Great plugin!
B
150
S
27
G
17
Posts: 909
Reputation: 32,330

PreviousNext

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 2 guests