[behavior] rex_spline

0 favourites
  • Jeff Skyrunner

    Do you mean that carrying custom data for each point?

    No, I don't have plan for this feature recently.

  • Ok, thank you

  • rexrainbow, Thanks for this plugin...I am trying to use this and get a javascript error when I try to create the spline "obj" at run time using --> System create obj and then setting obj --> set spline speed to some value. The error that I get is "Cannot set preX property" line 149 in rex_spline.js

  • kmsravindra

    Try to update this behavior to latest one

  • rexrainbow, I seem to have the latest one...just downloaded from here - http://c2rexplugins.weebly.com/rex_spline.html

    and it shows no changes..The timestamp and the bytes exactly match for all the files...

    The error says - " Cannot set property PreX of undefined. Line num - 149

    By the way, I am trying to create obj every 1sec at runtime, so that many are created that follow the path...The use case being, lets say I want to simulate current in a circuit.

  • kmsravindra

    I updated again. Please download it again.

    Please provide a simple test case if still find bugs. Thanks.

  • rexrainbow, thanks a lot...I will try it and let you know...

    I know that it is a big ask, but wanted to know if there could be possibility of branching off to a different path from each waypoint by assigning some probability to that waypoint. For example - lets say at an intermediate waypoint, I assign a probability of 50% and draw a different branch ( either at run time OR edit time), then the travelling obj could take either of the paths (at 50% probability) once it reaches that intermediate waypoint. I think this feature also needs the ability to draw multiple paths as well..Do you think such a thing can be possible?

  • kmsravindra

    Spline is a curve which interpolation internal points from 4 points

    • index previous one (-1)
    • index current (-0)
    • index next (+1)
    • index next two (+2)

    So it is not possible to change any point of position (-1, -0, +1, +2) while moving between (-0) to (+1). The curve will be broken.

    Try this solution if you want to smooth moving to a dynamic position

    • Add bullet behavior to drive sprite move along
    • Every tick rotate (action rotate toward position, not action set angle) the angle of sprite toward target position

    Here is a demo using this solution, try dragging the target point to see the footprint of object.

  • rexrainbow, Thanks for the response. I am aware of alternate ways of doing it in C2...The spline curve plugin was so easy to deal with, I Just was curious if such alternate branching could be implemented here...Anyway, thanks for the amazing plugin...

  • kmsravindra

    You could determine the position of middle points before starting if possible.

  • rexrainbow

    I'm using the plugin in my project and it seems working fine.

    For my needs, it has everything needed, thank you for your work.

  • rexrainbow, I wanted to know if this is possible - Lets say I create a spline path and instead of the "spline_obj" moving with some velocity, I can set its velocity to zero and give it a drag-drop behavior instead...Now when I drag the "spline_obj" in runtime, it is constrained to move only along the spline-path that I have created...Probably some logic could do the trick like - depending on its current "x" position while dragging, "y" position can be auto computed along the curve and the "spline_obj" sets its position to that (x,y)

  • kmsravindra

    A bullet + rotate toward position might be better when the nodes or current position changiing in run-time. See previous post

  • rexrainbow, Thanks for your response. Probably I didnt convey this too well in my earlier post. I didnt mean to change the node positions dynamically...The node positions will remain fixed. But I want to set the bullet velocity to zero for the object that is moving along the path and be able to drag that manually...When dragged this object should move along the path drawn.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a suggestion, but it seems like if you "Stop" the movement, it should be able to start where it stopped at rather than at the beginning of the spline when you use "Start".

    Or perhaps another command is a better idea, like "Continue".

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