[Plugin] jcw_trace (raycast)

0 favourites
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • 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.

  • 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.

  • >

    > >

    > > *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.

    > [quote:3p7rp5s8]

    > 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 <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing">

    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?

    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.

  • >

    > >

    > > *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.

    > [quote:1u81lm8u]

    > 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 <img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing">

    >

    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?

    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?

  • *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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • >

    > *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.

    I 100% agree with you, I also would have liked to have a third tilemap for jump-throughs, which would complicate issues even further, which leads me to suggest that tilemaps need the ability to set behaviors per tile/groups of tiles.

  • *quote snip*

    I 100% agree with you, I also would have liked to have a third tilemap for jump-throughs, which would complicate issues even further, which leads me to suggest that tilemaps need the ability to set behaviors per tile/groups of tiles.

    Well, that wouldn't really work, since adding behaviors to individual tiles would inevitably lead to people trying to add movement behaviors to them, and that wouldn't work for obvious reasons.

    The best workaround I can suggest is to have 3 separate Tilemap objects, instead of 3 instances of the same Tilemap object. That way, you can filter the traces however you want.

  • >

    > *quote snip*

    >

    > I 100% agree with you, I also would have liked to have a third tilemap for jump-throughs, which would complicate issues even further, which leads me to suggest that tilemaps need the ability to set behaviors per tile/groups of tiles.

    >

    Well, that wouldn't really work, since adding behaviors to individual tiles would inevitably lead to people trying to add movement behaviors to them, and that wouldn't work for obvious reasons.

    The best workaround I can suggest is to have 3 separate Tilemap objects, instead of 3 instances of the same Tilemap object. That way, you can filter the traces however you want.

    I tried that, but I couldn't copy the tiles to the clones with JSON, but that's on a side note, I don't want to derail this thread.

  • > made a wolfenstein 3d engine with this (:

    >

    >

    That looks pretty awesome Follder22! It would be cool to see in motion. <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    there, i optimized it alot, added camera moving up and down and added multiplayer with photon plugin <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    wasd - move player;

    left, right, up, down arrows - move camera

    e - open door

    link: http://follder22.webege.com/3dCrap/

  • >

    > > made a wolfenstein 3d engine with this (:

    > >

    > >

    >

    > That looks pretty awesome Follder22! It would be cool to see in motion. <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    >

    there, i optimized it alot, added camera moving up and down and added multiplayer with photon plugin <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    wasd - move player;

    left, right, up, down arrows - move camera

    e - open door

    link: http://follder22.webege.com/3dCrap/

    Wow, is this the first 2.5d thing done in C2? That's a real achievement! Thinking of forking this into another plugin?

  • Wow, is this the first 2.5d thing done in C2? That's a real achievement! Thinking of forking this into another plugin?

    I dont know how to make plugins (:

  • Follder22

    It seems that there are several big plugins in this project

    1. Q3D plugin(s)

    2. photon plugin

    3. jcw_trace plugin

    Thus it is not suitable to wrapping all things into a "single plugin", a well document template (capx) is a better solution. imo.

  • Follder22

    It seems that there are several big plugins in this project

    1. Q3D plugin(s)

    2. photon plugin

    3. jcw_trace plugin

    Thus it is not suitable to wrapping all things into a "single plugin", a well document template (capx) is a better solution. imo.

    Ahh I didn't realise it used q3d! Amazing work, looks like it might be able to put good use to that q3d I bought a year ago! ??

  • Follder22

    It seems that there are several big plugins in this project

    1. Q3D plugin(s)

    2. photon plugin

    3. jcw_trace plugin

    Thus it is not suitable to wrapping all things into a "single plugin", a well document template (capx) is a better solution. imo.

    But im not using q3d

  • Its just a bunch of sprites "line" with texture, and for each of them casts a ray, wich determinise height of a sprite from ray dustance, also, i dont think i need to combine photon plugin to it, only jsw_trace.

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)