2
$\begingroup$

I’m building a setup to make a character walk through a path using a Bézier curve, but I'm having a problem establishing the velocity

The problem

In my node setup I was able to change the length of the Bézier curve and still maintain the object travel velocity constant.

However, I’m not sure how to set the nodes in a way that I can input the velocity in real world units, such as kilometer per hour or meters per second.

enter image description here

Node Setup

I’m not sure if the velocity in this current setup makes sense, and the object is moving in a real world unit or is just arbitrary.

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ Is this the setup you're seeking?: i.imgur.com/swJAM2b.png Input the speed you want your character to have. With default scene units, it would be in meters/seconds (because Blender uses m as unit base, and you only have seconds available as a node output). Divide curve length by that, and you have your total travel time. "0-to-TravelTime" is the whole movement, so you map that to 0-1 factor. Current time (Scene seconds) would be the current factor in relation to that. Add your time shifts and speed multipliers as desired. $\endgroup$
    – Kuboå
    Commented Dec 12, 2022 at 11:32
  • $\begingroup$ @Kuboå That is what I was aiming for. Correct if I'm wrong: If I divide the velocity input by 3,6, wouldn't it make the final velocity in km/h? like that: i.imgur.com/iOBReMn.jpeg $\endgroup$ Commented Dec 12, 2022 at 15:11
  • 1
    $\begingroup$ Sure: i.imgur.com/ElfR1BP.png Is it not working for you? If not, could you share your setup (you could simplify it with a cube instead of woman etc) so it's easier to check? $\endgroup$
    – Kuboå
    Commented Dec 12, 2022 at 15:41
  • $\begingroup$ It is working, thank you! I was just pondering about the km/h setup so I could repurpose this node group for vehicles as well. I wanted to mark your comment as the answer to my question but stackexchange doesn't allow me to do this to comments. $\endgroup$ Commented Dec 12, 2022 at 16:47
  • 1
    $\begingroup$ Oh good. It was a comment made in passing so I didn't wanna post it as an answer in case it was erroneous. I'll make it into an answer so you can accept. $\endgroup$
    – Kuboå
    Commented Dec 12, 2022 at 16:50

1 Answer 1

2
$\begingroup$

By default, Blender is set to use meters as its base unit. Since the Scene Time node provides you with Seconds, unless you manipulate them further with Math nodes, your speed will happen to be meters per second. In your example, a barebones setup could like this:

enter image description here

You input your character's speed in m/s, and divide the length of your walking path by that, which results in your total travel time (in seconds). Since you want to use that travel time as the end point of your curve's factor (when that many seconds have passed, your character will have walked exactly the length of the curve—so the factor will be $1$), you need to Map Range the whole movement, using the travel time as the Max, and the Scene Time as the current value in relation to that. You can then employ various Math nodes to shift the time or multiply the speed.

If you'd like to switch between m/s and km/h depending on the object you're moving (human vs car), you can use a setup like this (where you would use a single value, but change its units between m/s and km/h with a switch):

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .