jfabdo
August 29, 2023, 10:51pm
1
If we have an actor called this way:
self.character = Actor(path[0]+'/models/ball.bam', {
'walk': path[0]+'/models/bouncing ball.bam',
'jump': path[0]+'/models/jumping ball.bam'
})
To call walk animation we do:
self.character.loop('walk')
But how do we get back to the initial state, called ‘models/ball.bam’ in this case?
Hi jfabdo,
You should be able to call stop()
on your Actor
to stop the looping animation.
self.character.stop()
Here’s a helpful page from the manual that can provide some more information.
https://docs.panda3d.org/1.10/python/programming/models-and-actors/actor-animations#basic-animation-playing
Cheers,
H3LLB0Y.
However, that won’t return the actor to the base, pre-animation pose (e.g. a base “T-pose”).
As to returning to that pose, I don’t believe that Actor has a “base animation”; what it rather has is just the state of not having an animation.
Reaching that state once an animation has been played, however, is something that I don’t know how to do, offhand. :/
1 Like
@Thaumaturge That’s true, my mistake. Good catch on your part I misunderstood the post…
I’ve done a bit of digging, and found some code that seems to do the trick.
Rather than calling self.character.stop()
use the following code.
animControls = self.character.getAnimControls()
for animControl in animControls:
animControl.getPart().clearControlEffects()
Actor.getAnimControls
on the linked page just below the top. (Didn’t have a Permalink for some reason…)
https://docs.panda3d.org/1.10/python/reference/direct.actor.Actor#direct.actor.Actor.Actor.getAnimControlDict
If you stop the animation prior, then passing animName=True
to the self.character.getAnimControls()
call will return ALL the animation controls so you can clear the effects from all.
Hope this can be of some use to you @jfabdo !
Cheers,
H3LLB0Y.
2 Likes