#How to give entity a target?

1 messages · Page 1 of 1 (latest)

cunning rose
#

I want to have an entity I spawn through API to follow another entity that I get from ray casting. Is there any way this is possible with the current API?

cunning rose
#

Is this possible in any fashion, no matter how hacky?

barren sphinx
#

you could use Entity.prototype.applyImpulse() to make the entity move towards the other entity

ornate island
#

custom entity?

barren sphinx
#

you don't include it in the actual code

cunning rose
ornate island
#

if it is a custom entity there is a lot of ways
either damage or tame

cunning rose
#

Ahh, but here's the kicker...the entity is floating/flying!

#

Apparently none of the typical ways work, at least not for me. I can get the target, but nothing will make the flying/floating entity move towards the target. Any ideas?

barren sphinx
cunning rose
#

To simulate fluid motion, that would require a lot of micro-nudges, and thus, a lot of overhead. I wonder if there's some more refined way to do this 🤔

barren sphinx
#

I had meant just constantly making the entity move directly towards the target

elfin narwhal
barren sphinx
elfin narwhal
#

apply damage 0 to it

#

to give it a target

cunning rose
#

So I was able to give it a target relatively easily with tags and using 'nearest_attackable_entity' component. However, a flying/floating entity doesn't seem to be able to approach it's target (broken components?). I was able to confirm it targetting & attacking the target when I gave it ranged attacks, like the ghast.