# Don't go through the ground!

#### ttlecaster

##### New member
Hi everyone!
I am learning animation on my own with Lightwave2019 and I would like to ask you the following:
-When you have a character who walks on a terrain, is there a way to tell lightwave that the character when walking does not cross the terrain where he is walking?
-Is there a way to make the character top the ground he is on?
If so, could you tell me how to do it or where I can find a tutorial to learn

Thanks since now!

#### Sensei

##### TrueArt Support
To have object moving on the top other geometry the easiest way is to make pivot point at the bottom of object.

e.g. make sphere. Default pivot point is center of sphere.
Move pivot to the bottom.
Then make plane geometry.
And you can roll sphere on the top of plane.

Alternative is to make special null. Make object (e.g. sphere) child of null.
Animate null and entire child object is also translated.
Animate sphere rotation and it will roll.
Train it with simple ball and plane to learn technique.

#### ttlecaster

##### New member
Thank you for the information!

#### Thomas Leitner

##### Member
There are many different situations in which you can need something like this.
If you want a character to walk over an uneven terrain, the following method can work:

This example uses a genoma rig for spiders. It is a modified form of the LW content scene "Genoma_Spider_Walk.lws" (the original spider walks on a flat terrain). To make the spider walk on uneven surfaces I modified the IK contoller.

Basically you animate your object with IK on a flat plane (e.g. you do a walk cycle). If you want your character to walk on an uneven surface, you can add the height of your terrain to the basic animation Y height.

To do this, use "Nodal Motion" in the Motion options of the IK controller.

With a "Ray Cast Geometry" node you can calculate the height of the terrain. Now you just add the Y position of the original animation and you get the new height of the IK controller.

Alternatively: With the "Node Item Motion" Nodal Editor from dpont (part of the DpKit, you can find it, and much more here: https://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html ) you can modify the motion channels individually without changing the other channels. The simpler node setup looks like this:

This doesn't look like much of a difference now, but that saves you from copying every single envelope into the "Make Vector" node during setup (plus such a critter has 8 legs!).

Notes: This setup only works in the Y axis. Your contoll objects must be in their initial position above the terrain ("Ray Cast Geometry" only looks in one direction, in this case downwards).

Of course, this method can be used not only for bone animation but also to move individual objects automatically on uneven surfaces.

I hope this gives you some inspiration.
ciao
Thomas

Last edited:

#### Thomas Leitner

##### Member
Helpful, though not so sexy as the ray cast thing, this method can be:

When you animate it can be very annoying when you break through the floor with your foot.

You can set the Minimum Position Limit of the IK controller for the Y axis to 0 meters (Motion Options > Contollers and Limits tab).

This prevents you from getting below 0 meters while creating the keyframes.

To note: With this simple setup, the IK controller can still get below 0 meters (e.g. if you move the whole object down), but not when the IK controller itself is animated. So it is only a little helper.
The maximum position limit should be set so high that it does not interfere.

And sometimes you forget that you have set limits and don't understand why the darn thing can't be moved down....

Of course you can also compine position limits with the "Ray Cast Geometry" method. In this case the ground height is added instantly.

Here is the node setup:

The unusual thing about this setup is that this time the ray cast geometry node uses a positive ray cast direction, so it looks upwards. The terrain must not be less than 0 meters high and it must be "visible" from below (nothing in front of it).
You should consider that this setup can also cause problems. For example, you cannot bake the channel including the added terrain height, at least not with the native Motion Baker.

Happy animating.
ciao
Thomas

Last edited:

#### ttlecaster

##### New member
Hay muchas situaciones diferentes en las que puede necesitar algo como esto.
Si quieres que un personaje camine sobre un terreno irregular, el siguiente método puede funcionar:

View attachment 149932

Este ejemplo usa una plataforma de genoma para arañas. Es una forma modificada de la escena de contenido de LW " Genoma_Spider_Walk.lws " (la araña original camina sobre un terreno plano). Para hacer que la araña camine sobre superficies irregulares modifiqué el controlador IK.

Básicamente, animas tu objeto con IK en un plano (por ejemplo, haces un ciclo de caminata). Si quieres que tu personaje camine sobre una superficie irregular, puedes agregar la altura de tu terreno a la altura Y de la animación básica.

View attachment 149933

Para hacer esto, use "Movimiento nodal" en las opciones de Movimiento del controlador IK.

View attachment 149934

Con un nodo "Ray Cast Geometry" puede calcular la altura del terreno. Ahora solo agrega la posición Y de la animación original y obtienes la nueva altura del controlador IK.

View attachment 149935

Alternativamente: con el editor de nodos "Movimiento de elementos de nodo" de dpont (parte de DpKit, puede encontrarlo y mucho más aquí: https://dpont.pagesperso-orange.fr/plugins/nodes/Additionnal_Nodes_2.html ) Puede modificar los canales de movimiento individualmente sin cambiar los otros canales. La configuración de nodo más simple se ve así:

View attachment 149936

Esto no parece una gran diferencia ahora, pero eso le evita copiar cada sobre en el nodo "Hacer vector" durante la configuración (¡además, una criatura de este tipo tiene 8 patas!).

Notas: Esta configuración solo funciona en el eje Y. Sus objetos de control deben estar en su posición inicial sobre el terreno ("Ray Cast Geometry" solo mira en una dirección, en este caso hacia abajo).

Por supuesto, este método se puede utilizar no solo para la animación de huesos, sino también para mover objetos individuales automáticamente en superficies irregulares.

Espero que esto te sirva de inspiración.
ciao
Thomas
Muchas gracias .... Creo que me cuesta mucho por el momento, pero intentaré entender !!!!

#### ttlecaster

##### New member
Helpful, though not so sexy as the ray cast thing, this method can be:

When you animate it can be very annoying when you break through the floor with your foot.

View attachment 149946

You can set the Minimum Position Limit of the IK controller for the Y axis to 0 meters (Motion Options > Contollers and Limits tab).

View attachment 149949

This prevents you from getting below 0 meters while creating the keyframes.

View attachment 149947

To note: With this simple setup, the IK controller can still get below 0 meters (e.g. if you move the whole object down), but not when the IK controller itself is animated. So it is only a little helper.
The maximum position limit should be set so high that it does not interfere.

Y a veces olvidas que has establecido límites y no entiendes por qué la maldita cosa no se puede mover hacia abajo ...

Por supuesto, también puede compilar límites de posición con el método "Ray Cast Geometry". En este caso, la altura del suelo se agrega instantáneamente.

View attachment 149948

Aquí está la configuración del nodo:

View attachment 149950

Lo inusual de esta configuración es que esta vez el nodo de geometría de lanzamiento de rayos usa una dirección de lanzamiento de rayos positiva , por lo que mira hacia arriba. El terreno no debe tener menos de 0 metros de altura y debe ser "visible" desde abajo (nada enfrente).
Debe tener en cuenta que esta configuración también puede causar problemas. Por ejemplo, no puede hornear el canal, incluida la altura del terreno agregada, al menos no con el Motion Baker nativo.

Feliz animación.
ciao
Thomas
Thank you!!!!!!!!!!!!!!!!!!!!! I will try all you tell me.

#### Oldcode

##### Member
One simple idea is use the Effector tool. If you place an Effector object on each foot bone, it will depress the ground so the foot will not pass through the ground. I've used this technique on hand bones as well to have a character press into something soft like a mattress. Here's a quick tutorial to set up the Effector.

Good Luck,

#### 3dbr

##### Member
Wow! Thank.
Can this be done via nodes to animate the size of the effector?

#### Oldcode

##### Member
Not sure. In the video, William uses the Stretch tool to change the shape of the null. Maybe you can use the Size tools to do the same thing.