I made a global function that should move an entity to a certain point in the map. It works on one model, but can’t seem to work on 2. I am looking for a way to get the function to work on another model without me having to go to the UI.
Is there a way to change this section of the UI via JS?
I’ve been playing with this code, specifically title: Player Entity, but no matter how much I change it to reflect the entity name I want to move, it still proceeds to move the entity declared in the UI (as above - currently Player3)
I noticed that “Player Entity” is only a title. Will there be a way to change it to Player (other model) from Player3 via script?
Looking forward to your reply and thanks!
Will there be a way to move the entity Player instead of Player3 using js*
Found a way to tag the proper entity by using this.app.root.findByName(playerEntity). However, now I can’t make them run the function at the same time. Is there a way to make playcanvas or JS run the same function for 2 different entities at the same time?
doing this now will only make the first function fire.
Let me know and thanks!
Sorry. forgot to add the project link:
GM-global test_4 | Editor (playcanvas.com)
I’m trying to run moveAnimate on both models, but it seems to be only firing one and not animate the other. Also, will it be possible to move both using the same function at the same time?
Not quite sure what you are trying to do here as the idea of using a script attribute is to make it easier to assign in the Editor
The point and click script was designed to make one object be moved by the user with the mouse and what it looks like you trying to do is move other objects through code (maybe in a multiplayer setting?)
If so, you need to have a separate script that moves the other players/entities from network events/code rather than trying to do it from this pointAndClick script.
It might be worth separating out the movement logic from the input in that script so that you aren’t replicating the movement logic twice?