panda3d.core.Character

from panda3d.core import Character
class Character

Bases: PartBundleNode

An animated character, with skeleton-morph animation and either soft- skinned or hard-skinned vertices.

Inheritance diagram

Inheritance diagram of Character

__init__(param0: Character) → None
__init__(name: str) → None
clearLodAnimation() → None

Undoes the effect of a recent call to setLodAnimation(). Henceforth, the character will animate every frame, regardless of its distance from the camera.

findJoint(name: str) → CharacterJoint

Returns a pointer to the joint with the given name, if there is such a joint, or NULL if there is no such joint. This will not return a pointer to a slider.

Return type

CharacterJoint

findSlider(name: str) → CharacterSlider

Returns a pointer to the slider with the given name, if there is such a slider, or NULL if there is no such slider. This will not return a pointer to a joint.

Return type

CharacterSlider

forceUpdate() → None

Recalculates the character even if we think it doesn’t need it.

getBundle(i: int) → CharacterJointBundle
Return type

CharacterJointBundle

static getClassType() → TypeHandle
Return type

TypeHandle

mergeBundles(old_bundle: PartBundle, other_bundle: PartBundle) → None

Merges old_bundle with new_bundle. old_bundle must be one of the PartBundles within this node. At the end of this call, the old_bundle pointer within this node will be replaced with the new_bundle pointer, and all geometry within this node will be updated to reference new_bundle.

Deprecated: Use the newer version of this method, below.

mergeBundles(old_bundle_handle: PartBundleHandle, other_bundle_handle: PartBundleHandle) → None

Merges old_bundle_handle->:meth:~Character.getBundle with new_bundle. old_bundle_handle must be one of the PartBundleHandle within this node. At the end of this call, the bundle pointer within the old_bundle_handle will be replaced with that within the new_bundle_handle pointer, and all geometry within this node will be updated to reference new_bundle.

Normally, this is called when the two bundles have the same, or nearly the same, hierarchies. In this case, new_bundle will simply be assigned over the old_bundle position. However, if any joints are present in one bundle or the other, new_bundle will be modified to contain the union of all joints.

The geometry below this node is also updated to reference new_bundle, instead of the original old_bundle.

This method is intended to unify two different models that share a common skeleton, for instance, different LOD’s of the same model.

setLodAnimation(center: LPoint3, far_distance: float, near_distance: float, delay_factor: float) → None

Activates a special mode in which the character animates less frequently as it gets further from the camera. This is intended as a simple optimization to minimize the effort of computing animation for lots of characters that may not necessarily be very important to animate every frame.

If the character is closer to the camera than near_distance, then it is animated its normal rate, every frame. If the character is exactly far_distance away, it is animated only every delay_factor seconds (which should be a number greater than 0). If the character is between near_distance and far_distance, its animation rate is linearly interpolated according to its distance between the two. The interpolation function continues beyond far_distance, so that the character is animated increasingly less frequently as it gets farther away.

The distance calculations are made from center, which is a fixed point relative to the character node, to the camera’s lod center or cull center node (or to the camera node itself).

If multiple cameras are viewing the character in any given frame, the closest one counts.

update() → None

Recalculates the Character’s joints and vertices for the current frame. Normally this is performed automatically during the render and need not be called explicitly.

updateToNow() → None

Advances the character’s frame to the current time, and then calls update(). This can be used by show code to force an update of the character’s position to the current frame, regardless of whether the character is currently onscreen and animating.

Deprecated: Call update() instead.

writePartValues(out: ostream) → None

Writes a list of the Character’s joints and sliders, along with each current position, in their hierchical structure, to the indicated output stream.

writeParts(out: ostream) → None

Writes a list of the Character’s joints and sliders, in their hierchical structure, to the indicated output stream.