Creating a snapping behavior
Fafnir312
Member Posts: 161
I'm moving an actor toward the player using acceleration. This works fine. However, when the actor comes within a certain distance from the player I want to apply massive drag to that actor effectively slowing it down to a crawl. But my rule isn't working. By all appearances it seems it should. Magnitude reads as it should. Maybe I'm missing something.
Here is my snapping rule:
http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/snap_behavior.png
EDIT:
Even setting conditions that are obviously true doesn't work ie. snapDist = 2000 and setting the rule to be if snapDist > 0
EDIT:
Erm.. OK so I had another rule conflicting with this one. Though I still don't have it working, but I think I'm closer.
Here is my snapping rule:
http://i3.photobucket.com/albums/y58/MattVG/Game Stuff/snap_behavior.png
EDIT:
Even setting conditions that are obviously true doesn't work ie. snapDist = 2000 and setting the rule to be if snapDist > 0
EDIT:
Erm.. OK so I had another rule conflicting with this one. Though I still don't have it working, but I think I'm closer.
Comments
You could use an accelerate towards in the opposite direction.
EDIT:
Since I wanted an incremental decrease in the velocity and getting the opposite angle wasn't possible (my math is lousy) I ended up just decreasing the linear X Y velocity as long as it's velocity was above that of the player.