1 decade ago by folktrash
Looking to bound an entity area of movement. Setting the initial position to vars, and checking against a radius. The thing is - the first time it reports as out-of-bounds, and we flip the direction. The next report is still out of bounds (though it's on it's way back) and so it flips direction again.
The emergent behavior is a "jiggle" right at the radius edge. The default spike entity has this behavior as well. If it has a collision, it works fine, but if it hits the boundary, it is stuck there, switching back and forth.
Is there a "next" position? This must be going on in the collision code, but before I start digging in there, I thought I'd throw it out there.
How do you deal with entity AI and bounding an area of exploration? I see last.x/y but that exhibits the same behavior.
The emergent behavior is a "jiggle" right at the radius edge. The default spike entity has this behavior as well. If it has a collision, it works fine, but if it hits the boundary, it is stuck there, switching back and forth.
Is there a "next" position? This must be going on in the collision code, but before I start digging in there, I thought I'd throw it out there.
How do you deal with entity AI and bounding an area of exploration? I see last.x/y but that exhibits the same behavior.