Author Topic: PAvoider not working  (Read 396 times)

0 Members and 1 Guest are viewing this topic.

Offline snobes

PAvoider not working
« on: September 15, 2023, 12:04:17 PM »
Hello.

So I'm trying to use PAvoider since my use case is to have an Actor (a hen) avoid another Actor (the gEgo) (ie. gEgo walks to the hen and the hen walks away and tires to avoid the gEgo). However, I think PAvoider is not meant for this. From the code, the description of PAvoider is:

;   
;    In contrast to the Avoider in SCI0 that makes an Actor avoid certain control colors, this
;    avoider has been adjusted to use polygons for SCI1.1.
;   
;    Example usage::
;   
;       (gEgo setAvoider: PAvoider)


From the description, it sounds like PAvoider is meant to avoid certain polygons, not other Actors. However, I still do not understand which polygons the Actor would avoid if given a PAvoider. I've tried (gEgo setAvoider: PAvoider) in the init of the Room object, but nothing happens. Am I missing something on how to use PAvoider?

As a side note, since most likely PAvoider is not suitable for my use case, is there a class that makes one Actor avoid another Actor?

Thanks.




Offline Kawa

Re: PAvoider not working
« Reply #1 on: September 15, 2023, 02:01:20 PM »
According to the leaked LSL3 code's Avoider's comments:

Normally, when an Actor encounters a control line or other object
which blocks its normal motion, it simply stops right there.
If, however, an Avoider is attached to such an Actor, it will take
over and attempt to direct the Actor around whatever obstruction
it has encountered.


So an "Avoider" is not what you need to have the hen "avoid" Ego at all, despite the name. What you need is the non-standard opposite of the Follow or Chase Motion classes. You'd have to roll your own cos I can't find any for now.

(Note that attaching a PolyPath Motion to Ego (by walking somewhere perhaps) does not involve any Avoiders, polygonal or control color based. The pathfinder already worked out how to go around polygonal obstacles -- and that's why other Actors can still block your way!)

Offline snobes

Re: PAvoider not working
« Reply #2 on: September 15, 2023, 02:27:38 PM »
Thanks for the clarification. All makes sense now.

I'll see if I implement an "Avoider" Motion class. Could be useful for future use cases.

Offline Kawa

Re: PAvoider not working
« Reply #3 on: September 15, 2023, 02:34:50 PM »
Don't call it that or you'll confuse the compiler~

Offline snobes

Re: PAvoider not working
« Reply #4 on: September 15, 2023, 02:48:38 PM »
Good to know.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.02 seconds with 18 queries.