Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › MoveToPointHelper question

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15806

    Darren

    Hi,

    I am using MoveToPointHelper for my baddy tanks to chase the player.  When they reach the distanceToTargetThreshold they need to stop.  I am using the signal onTargetReached for this.

    This works the first time the baddy tank reaches the threshold.  If the player then moves away (increasing the distance), the next time the baddy tank comes within the threshold, the onTargetReached does not appear to be triggered.  Is this signal only called once?  Is there a way that it can be reset when the distanceToTarget is greater than the target threshold?

     

    My second question – earlier in January Alex said you would expose more functionality of the CameraVPlay component in an update that was coming.  Has the update happened?  I can’t seem to find it anywhere, but don’t know where to look.

     

    Thank you

    Darren.

    #15851

    Günther
    Felgo Team

    Hi Darren!

    I just had a short look at the MoveToPointHelper and the signal fires correctly for me.
    Maybe there’s is something different with your use-case: can you set up a small sample Felgo project with the minimum code required to reproduce the issue and send it to support@felgo.com. We will have another look then.

    Regarding the Camera component: Alex will follow up with you on that.

    Best,
    Günther

    #15883

    Darren

    Thanks Gunther

    The signal does appear to fire correctly, but if the entities move away from each other, it doesn’t fire the second time they get close again.  If I reset the target point to a different target, it does fire the signal when it reaches the threshold distance.  Therefore my question is:

    • Once the target distance is reached, the component will fire the onTargetReached signal.  It will then not fire it again – I see this as correct behaviour as the distance is now less than the target distance.  But does the component keep checking to see if the distance between the entities becomes greater than the target distance again?

    I’ll have another look at this issue once I get v-play working again… it’s not working properly since installing the latest version. I’ll ask about that in another thread.

    Cheers

    Darren.

    #15887

    Günther
    Felgo Team

    Hi Darren!

    Sorry, I maybe didn’t describe myself clear enough:
    In my test, I moved a Rectangle to a targetPoint with MoveToPointHelper. If I changed the targetPoint then after the signal fired, it was fired once again as soon as the new targetPoint was reached. So for me onTargetReached fires multiple times whenever a new targetPoint was reached.

    This is why I asked about a small sample project with minimum code to reproduce your issue: We can then exactly test your use-case and have a look what’s going wrong.

    Best,
    Günther

     

    #15890

    Darren

    Hi Gunther!

    Thank you for your explanation. What you are describing works for me, just as you described.  However I am not using a targetPoint and your test won’t replicate the problem.  I am using targetObject – the issue is that after the signal has been fired once, if the targetObject moves out of range and then comes back into range, the signal is not fired.  Does that make sense?

    Thanks

    Darren.

    #15895

    Günther
    Felgo Team

    Hi Darren!

    You are right, the signal is only fired once when using targetObject – we’ll fix that with one of the next Felgo updates.
    I added the issue to our bugtracker – thanks again for reporting!

    As a workaround, please use targetPoint instead – it should be possible to simply use it like this (replace yourTarget with the targetObject you use currently):

    MoveToPointHelper {
          id: moveToPointHelper
          // targetObject does not work, use targetPoint instead
          // targetObject: yourTarget 
          targetPoint: Qt.point(yourTarget.x, yourTarget.y)     
          onTargetReached: console.log("TARGET REACHED")
        }

    Cheers,

    Günther

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded