#Reacting to control points on a Path3D path

1 messages · Page 1 of 1 (latest)

molten ridge
#

I have an AnimatedSprite3D fish swimming along a path. I want it to change from its SwimmingLeft loop to a TurnLeftToRight when it reaches a specific control point on the Path3D, and then change again to SwimmingRight when it completes that turning animation.

Is there a way to reference the actual control points on a Path3D? All I've seen so far is how to reference Progress and ProgressRatio, but these don't really serve my purposes as the length of the path might change down the line. I don't want to have to manually check where the fish should be turning every time I adjust the path.

ivory condor
#

Okay. I'm not 100% sure what the next step is, but I have a pretty good first step for you.

Let's say you know exactly which point you want to trigger the animation. Let's say index 5. var anim_switch : Vector3 = $Path3D.curve.get_point_position() I believe this returns the point in local space. Then you can check if fish.position - anim_switch < some_threshhold to switch. I think? Here's the docs on Curve3D since all that Path3D tells us is that "I have a Curve3D!"

#