Johncw87's Forum Posts

  • >

    > > -quote snip-

    > >

    > > Hello! I again have the same error but this time it is in Android 4.2.2.

    > >

    > > Chrome Version: 31.0.1650.59

    > >

    > > Can you do something about it for compatibility?

    > >

    > > -image snip-

    > >

    >

    > I've updated the plugin with a fallback implementation of Math.sign from here:

    > https://developer.mozilla.org/en-US/doc ... /Math/sign

    >

    > I tested Internet Explorer very briefly, and it appears to work. It will probably also work on that outdated chrome for android, too. Download link is the same Dropbox link as always.

    >

    Hi, thanks for the update !.

    I installed the new version and suddenly now I have this error when I open my project.

    This error did not exist before, will it be due to the update of the plugin ?.

    -image snip-

    I highly doubt that this is related to updating my plugin, as I didn't change the edittime.js file at all. The only way I could see an editor bug being related is if you had previously modified my plugin's edittime.js (maybe to un-comment the incomplete "Trace Box" action), since re-installing it would undo those changes.

  • -quote snip-

    Hello! I again have the same error but this time it is in Android 4.2.2.

    Chrome Version: 31.0.1650.59

    Can you do something about it for compatibility?

    -image snip-

    I've updated the plugin with a fallback implementation of Math.sign from here:

    https://developer.mozilla.org/en-US/doc ... /Math/sign

    I tested Internet Explorer very briefly, and it appears to work. It will probably also work on that outdated chrome for android, too. Download link is the same Dropbox link as always.

  • Is it possible to determine the first hit? I need to add special visualization for the first hit.

    Not sure what you mean? The HitX and HitY are the first hit. It ignores anything that isn't the first hit.

  • I found that the error only occurs in Internet Explorer 11.

    In Chrome it works well.

    That... actually helps. I re-created the error, and now see it in English.

    [quote:1xevi66t]

    Javascript error!

    Object doesn't support property or method 'sign'

    Apparently Internet Explorer doesn't support Math.sign(). At all. This is the kind of thing that makes web developers hate IE.

    This is from MSDN:

    [quote:1xevi66t]

    Supported in Microsoft Edge (Edge browser). Also supported in Store apps (Microsoft Edge on Windows 10). See Version Information.

    Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.

    I'm not really sure what I'm gonna do about that. I'm leaning heavily towards "screw Microsoft and their non-standards-compliant browser".

  • Hello, I do not know if this bug has been reported but I'll do it now.

    I guess it's a bug in the plugin.

    Any clue of the problem?

    By the way, thanks for the plugin !.

    Well, the error isn't in English, but I still see a line number. It appears to have an issue with a variable being passed to Math.sign(). The number is derived only from the start and end positions of the trace, so make sure that you aren't making those invalid somehow. Some expressions (like the parameters in the function plugin) can return both numbers and strings. Perhaps you are accidentally passing a string to something that requires a number?

  • Would it be possible to turn this into a behavior so different objects can store different trace results? I'm not a programmer so I have no idea how difficult that would be.

    Well, I could, but I don't see the utility of this. In my project, it's being used to detect ledges for the player to grab on to. After the check is complete, I no longer care about what the results are, and I can use the object again for something else. If you really need to store the results longer, you could always save them in some variables or an array, or you could add the trace object to a container. I have NOT tested this plugin in a container, but it should work just like the array object, having a unique instance (and results) for each instance of the container.

  • Try Construct 3

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

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

    Of course. The one time I didn't update the example (which used the minifier), the minifier stops working.

    The fix turned out to be easy, though. I had added default parameters to a Javascript function, which is apparently not yet standardized (but supported by Firefox). It would seem that the minifier didn't like this, so I took that out.

    Re-download the plugin.

  • This forum needs Facepunch-level efficiency for dealing with spammers. The best solution would be more moderators in more timezones. Another thing you could try is some sort of community moderation, where if a post is reported enough times by users with C2 licenses, it will be hidden until proper moderator action can be taken. Or, if a large number of reports occur in a short timespan, send out text messages to all moderators.

  • I've updated the plugin. If a trace starts inside of an object, the hit position will now be at the start, instead of hitting the inside of the polygon. I'm not quite sure what to do with the normal in this case, so I just set it to be opposite of the trace line. I also added a HitFrac expression, which is used internally to calculate the hit position. I find it useful for checking if the trace started inside an object, but I'm sure there are other uses for it.

    Not much progress on the hull trace front. Resources on the topic are hard to find.

  • I've updated the plugin again.

    • Added padding property, to set how much space is left between the hit object and the result position
    • Added 'Hit' condition which returns true if the last trace performed hit something.
    • Fixed normal direction on flipped tiles and other polygons with alternate winding.
    • Now using a simpler calculation for reflection.

    The example now has an absurd reflection test on the tilemap layout.

    I'm planning on adding hull traces, but I'll need to do some research on the math required for that.

  • Hey, great plugin. Thanks for sharing.

    I made an icon you can use if you like it. icon

    the 16x16 looks nice, but the larger ones look like they have been upscaled from that smaller one, and don't look as nice.

    Nice plugin. Here's a quick thought on the normal being wrong on flipped tiles. Normally the collision polygon have it's points ordered in the same way (cw or ccw). This is called winding. So when a ray hits an edge you can take the angle from one point of the segment to the other, and if the points have clockwise winding you can subtract 90 and get the normal.

    Mirroring will switch the winding and so will mirroring. So if something is both flipped and mirrored the winding will be the same as they are originally. Negative sizes of sprites have the same affect as flipping and mirroring.

    Roughly it would look like this, it might need to be swapped:

    If mirrored xor flipped

    EdgeAngle+90

    Else

    EdgeAngle-90

    That can fail though if the user creates a collision polygon with a reversed winding. It's not common but it has happened before. I didn't handle it and instead had the user correct his collision polygon, but you can handle it in code by either checking the winding of the polygon or sampling a point on one side of the edge to know which side is inside the polygon.

    I am already aware of what causes it, and have been considering testing which side of the line the start point is on to fix it. But thanks anyway.

    As far as speed goes, the best improvement would be to do some kind of spacial partitioning of the objects you cast to.

    Isn't this what the collision cells do?

    Ps.

    You can also calculate the reflection angle without vector math.

    ReflectAngle = 2*normal-rayAngle

    Thanks! I'm gonna use this now.

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

  • Here is a comer case

    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?

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

  • Without seeing the assets, it would be hard to say what would be best. So let's look at some assets from a tile-based game.

    Do you see those boxes in the picture? They are composed of multiple parts (tiles).

    A 9-patch will allow you to create boxes like the ones from the screenshot using a single image.

    If you put the above image into a 9-patch, set all of the margins to 16, and set the edges to tile, you will have a single object that you can resize at will, and all of the 'parts' will automatically be rendered in the correct places.

    If your assets are not tile-based, then you will need a different approach. In the interests of keeping memory usage down, you may want to add each graphic as a separate sprite, and use containers and/or event logic to keep the parts together. You may also want an invisible object to handle the game logic of the platform (such as collision and movement), and just have the art assets move along with it.

    But, as stated at the beginning of this post, it's hard to say what you need without seeing the assets (or at least a better description on how they fit together). Everything in this post is speculation as to what you might need.