Up vector override

19 views
Skip to first unread message

Paolo DE LUCIA

unread,
Jul 14, 2023, 12:58:12 PM7/14/23
to Atoms Crowd
Hello,
First post here and it seems nobody came across this problem :
I need to make some characters run over a mountain and then crawl when the slope reaches a certain angle.
- The run cycle has to be ran with an Up vector facing the Y direction.
- The crawl cycle needs a gravity field to be oriented perpandicular to the slope.

Whatever I'm trying, I can't find a way to mix then both.
- The gravity field is attached to a state machine which embed all the animation clips, making it impossible to specify per type of animation.
- I've tried to override the "gravity" agent metadata, as well as the "up" metadata with a behaviour tree, without any success.

Is it a software limitation or am I doing something wrong ?
Thanks in advance.

Daniele Federico

unread,
Jul 14, 2023, 1:06:17 PM7/14/23
to Atoms Crowd, Paolo DE LUCIA
Hello Paolo,
thanks for reaching out and welcome.

Unfortunately it is not possible to achieve what you are asking with standard modules, but I have prepared a scene for you to show you a way to go.
You can change the "gravity" metadata via script or any other way.

In the scene you will find an agent walking on a slope, the agent group containing that agent has a few modules:
- an add metadata adding a double metadata "alignGravity" which is created on the first frame and set to 0
- two area triggers modifying the value of the "alignGravity" metadata from 0 (not aligning the up vector to the mesh normal) and 1 (aligning the up vector to the mesh normal). Each area trigger has a 10 blend frame to smooth the transition.
- a custom module (GravityModifier). This module takes as input the height field name (set to "hf") and the name of the metadata (set to "alignGravity"). Internally the module simply modifies the gravity metadata of the agent based on the "alignGravity" metadata value.

You can see the GravityModifier module inside the AtomsUI under the BehaviourModules tab.

Please let us know if you need further help with this or have any other questions.

Thanks,
Daniele
slopeWalk.ma

Daniele Federico

unread,
Jul 17, 2023, 5:16:27 AM7/17/23
to Atoms Crowd, Daniele Federico, Paolo DE LUCIA
Hello Paulo,
I just realized there could be another way (more artist friendly) to achieve what you are asking.

You could use a gravity field mesh different from the height field, so that you could use the former to drive the up vector of the agent while the agents would still be adapting to the ground.
Have a look at the attached scene (please note the gravity field mesh should be properly modelled, I just edits the height field mesh quickly to give you an idea). 

The disadvantage of this method is that you won't be able to disable the gravity alignment as with the first method I mentioned, but it could work in case you require more art-direction by the user.

I hope this helps.

Thanks,
Daniele

slopeWalk2.ma

Paolo DE LUCIA

unread,
Jul 17, 2023, 10:11:18 AM7/17/23
to Atoms Crowd, Daniele Federico, Paolo DE LUCIA
Hello Daniele and thanks for the concern !
I went through the first method, which from my perspective is a very good case of study.
Everything looks logical to me but it only works when using the "man" asset and not the one I've build. I'm wondering where the difference comes from. Even when using the simplest stack possible (I mean a layout and then an animationClipReader) the man follows the given gravity vector while mine stays at 0,-9.8,0.
So the second option comes in time as I may use it as a workaround... but still I really would like to know if the agent prep need to be done in a certain way to allow the gravity vector to be tweaked.

Daniele Federico

unread,
Jul 17, 2023, 10:12:27 AM7/17/23
to Atoms Crowd, Paolo DE LUCIA, Daniele Federico
Hello Paolo,
it's hard to say without seeing your assets.

Is there any chance you can send us the skeleton file and the animation to sup...@toolchefs.com?

Thanks,
Daniele

Reply all
Reply to author
Forward
0 new messages