Pathfinder angle re-initializatio when start movin

0 favourites
  • 4 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • Link to .capx file :

    https://www.dropbox.com/s/6b0lqvb8zb6cejh/bugPathFinder.capx

    Steps to reproduce:

    1. create a sprite with pathfinding

    2. during execution, change sprite angle

    3. calculate path/move along path

    Observed result:

    The sprite angle is reinitialized to its spawning angle before moving.

    Expected result:

    The sprite should start moving using its current angle.

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: yes

    Operating system & service pack:

    Windows 7 SP1

    Construct 2 version:

    r136

    ------

    Some personal observations after research in the behavior code, the problem is that the a variable (the angle of the object, store into the behavior) is set on creation of object, and then used in the tick function when isMoving is set to true (starting moving), if the rotation is allowed of course.

    But the behavior never calls runtime.add_bbox_changed_callback, never updating its inner angle (a), making it believe it never rotated, even if the sprite (or any over draw-able object in fact) called setAngle

    Hope this helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, I don't like problems I can't correct.

    So here is the debug. In the runtime.js of the pathfinding behavior, just add the following code in the behinstProto.oncreateFunction, once this.a is set (line 73) :

              this.inst.add_bbox_changed_callback(function (_this){

                  ?return function (inst) {

                        _this.a = inst.angle;

                  ?};

              }(this));

    I used what I learned from your code in particules plugin (the only one I found using the add_bbox_changed_callback function), but I didn't see any "remove_bbox_changed_callback", so I didn't know if and how to remove the eventlistener once the object is destroyed. Not finding the function in any other behavior made me think there was a more appropriate function, didn't find one though.

  • Should be fixed in the next build.

  • Ashley

    Thanks a lot ! Looking forward to see how you corrected it, still learning all this :)

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