[Plugin] jcw_trace (raycast)

  • great plugin! thanks a lot!

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

  • Ok, I'll try that. I was worried about having multiple traces overwriting results. For instance having a laser constantly firing a trace and then a few enemies using trace for line of sight or firing instant bullets.

  • A behavior version where you can check for the distance to an obstacle on angle x would be quite usefull to build better AI.

    Something like AI_Sprite.raycast.checkDistance(angle) would return the distance to the obstacle at the angle choosen.

    image

    It could be used to support the pathfinding behavior to:

    1. keep the AI from grinding along the walls (keep a little distance from walls or move in the center of hallways... stuff like that)

    2. interact with or avoide moving obstacles without refreshing the obstaclemap of the pathfinding behavior

    I know this is all possible with the plugin how it is right now, it would just be more convenient this way i think.

    Something like trace ray at angle x starting from pos x,y with max length x would be great no matter what tho

  • Yeah... this is some solid cool shiz!

    I can't wait to see where this goes

    ~Sol

  • really cool plugin, thanks!

  • Fantastic! You are hero, mate!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Frankly, Ashley should have included this 5 years ago. The lack of this feature is the #1 reason I am currently developing in unity instead of c2. Great addition!

  • Feature request:

    There are already has normal angle, reflection angle. It might be possible to add expression to get angle of polygon -

    The normal angle is orthogonal with polygon angle.

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

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

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

    I'm almost sure that the parameters sent to the function are numbers.

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

    In Chrome it works well.

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

  • It is not connected with the plugin, but for the ray I get this:

    The ray goes in both directions from the center. The second point is mouse.

    I can't understand what is wrong.

  • Sorry - I have found the mistake - it was imagepoint.

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