Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Move controller to specific point
#1
Is it possible to move controller from current position to target position with animation from script? For example, I want move controller from 0.0 to 0.4 and then stop it.
Reply
#2
Yes, enable Animate. Speed then means distance delta while duration is the time that delta is applied. Use the AnimationCurve to set easings, overdubs etc...
Reply
#3
(02-23-2016, 07:22 PM)Jake Wrote: Yes, enable Animate. Speed then means distance delta while duration is the time that delta is applied. Use the AnimationCurve to set easings, overdubs etc...

That's interesting, is that in the docs? I totally missed that. How would I tie that in to a swipe or drag touch input? Basically a more or less one to one ratio of distance of swipe across the screen to the distance moved along a spline as the drag is happening? I'm getting noticeable choppiness of a camera moving along a spline and I think it's because I'm setting <controller>.position every update.

James
Reply
#4
You're talking about changing length/distance while animating? Hmm, never tried that, but I bet you'll need to stop, set and restart animation to make it smooth. But in that case I would recommend creating a custom controller for that purpose, it's more straightforward and easier to extend. The key is not to set the controller's position (i.e. transform.position), but controller's relative (TF) or absolute (Distance) position instead.

E.g. add a field for your target TF and override Refresh() to animate Speed based on a tweening, then let the controller do it's usual work.
Reply
#5
I'm setting the position property on the controller (not the transform) every frame based on input. If that's not a good way to do it then I need to figure out something else. Basically, each time someone drags their finger across the screen, the controller should move the same consistent distance along the spline. I'll look into what you suggested, thank you for the feedback.

James
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to generate gameobject on the control point Yang Yi 0 1 Yesterday, 11:43 AM
Last Post: Yang Yi
  Can't set CG Path Controller j95677 4 22 10-04-2024, 06:55 PM
Last Post: j95677
  Player move with object mcarman 4 8 07-29-2024, 06:49 PM
Last Post: mcarman
  How to use CG Volume Controller j95677 5 12 07-17-2024, 07:15 PM
Last Post: j95677

Forum Jump: