本文整理汇总了C#中FullBodyBipedEffector类的典型用法代码示例。如果您正苦于以下问题:C# FullBodyBipedEffector类的具体用法?C# FullBodyBipedEffector怎么用?C# FullBodyBipedEffector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FullBodyBipedEffector类属于命名空间,在下文中一共展示了FullBodyBipedEffector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InverseTransformEffector
// Placing an effector so that an arbitrary Transform (target) ends up at targetPosition
private void InverseTransformEffector(FullBodyBipedEffector effector, Transform target, Vector3 targetPosition, float weight) {
// Direction from the target to the effector
Vector3 toEffector = ik.solver.GetEffector(effector).bone.position - target.position;
// Positioning the effector
ik.solver.GetEffector(effector).position = Vector3.Lerp(ik.solver.GetEffector(effector).bone.position, targetPosition + toEffector, weight);
}
示例2: OnInteractionFinish
private void OnInteractionFinish(
FullBodyBipedEffector effector,
InteractionObject obj)
{
if (this.finish == null)
this.finish = new Dictionary<FullBodyBipedEffector, bool>();
if (this.finish.ContainsKey(effector))
this.finish[effector] = true;
}
示例3: OnInteractionTrigger
private void OnInteractionTrigger(
FullBodyBipedEffector effector,
InteractionObject obj)
{
if (this.triggers == null)
this.triggers = new Dictionary<FullBodyBipedEffector, bool>();
if (this.triggers.ContainsKey(effector))
this.triggers[effector] = true;
}
示例4: OnStart
// Called by the InteractionSystem when an interaction starts
private void OnStart(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {
if (effectorType != FullBodyBipedEffector.LeftHand) return;
if (interactionObject != obj) return;
// Rotate the pivot of the hand targets
RotatePivot();
// Rotate the hold point so it matches the current rotation of the object
holdPoint.rotation = obj.transform.rotation;
}
示例5: IsInInteraction
/// <summary>
/// Determines whether this effector is interaction and not paused
/// </summary>
public bool IsInInteraction(FullBodyBipedEffector effectorType) {
if (!IsValid(true)) return false;
for (int i = 0; i < interactionEffectors.Length; i++) {
if (interactionEffectors[i].effectorType == effectorType) {
return interactionEffectors[i].inInteraction && !interactionEffectors[i].isPaused;
}
}
return false;
}
示例6: OnDrop
// Called by the InteractionSystem when an interaction is resumed from being paused
private void OnDrop(FullBodyBipedEffector effectorType, InteractionObject interactionObject)
{
if (effectorType != FullBodyBipedEffector.LeftHand) return;
// Make the box independent of the character
box.transform.parent = null;
// Turn on physics for the box
if (box.GetComponent<Rigidbody>() != null) box.GetComponent<Rigidbody>().isKinematic = false;
}
示例7: OnPause
// Called by the InteractionSystem when an interaction is paused (on trigger)
private void OnPause(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {
if (effectorType != FullBodyBipedEffector.LeftHand) return;
if (interactionObject != obj) return;
// Make the object inherit the character's movement
obj.transform.parent = interactionSystem.transform;
// Make the object kinematic
var r = obj.GetComponent<Rigidbody>();
if (r != null) r.isKinematic = true;
// Set object pick up position and rotation to current
pickUpPosition = obj.transform.position;
pickUpRotation = obj.transform.rotation;
holdWeight = 0f;
holdWeightVel = 0f;
}
示例8: Apply
// Applies the weight curves and multipliers to the FBBIK solver
public void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, InteractionTarget target, float timer, float weight)
{
for (int i = 0; i < weightCurves.Length; i++) {
float mlp = target == null? 1f: target.GetValue(weightCurves[i].type);
Apply(solver, effector, weightCurves[i].type, weightCurves[i].GetValue(timer), weight * mlp);
}
for (int i = 0; i < multipliers.Length; i++) {
if (multipliers[i].curve == multipliers[i].result) {
if (!Warning.logged) Warning.Log("InteractionObject Multiplier 'Curve' " + multipliers[i].curve.ToString() + "and 'Result' are the same.", transform);
}
int curveIndex = GetWeightCurveIndex(multipliers[i].curve);
if (curveIndex != -1) {
float mlp = target == null? 1f: target.GetValue(multipliers[i].result);
Apply(solver, effector, multipliers[i].result, multipliers[i].GetValue(weightCurves[curveIndex], timer), weight * mlp);
} else {
if (!Warning.logged) Warning.Log("InteractionObject Multiplier curve " + multipliers[i].curve.ToString() + "does not exist.", transform);
}
}
}
示例9: OnInteractionResume
private void OnInteractionResume(
CrossfadeInteractionHandler handler,
FullBodyBipedEffector effectorType,
InteractionObject interactionObject)
{
if (this.BodyResume != null)
this.BodyResume(effectorType, interactionObject);
}
示例10: GetLimbMapping
/// <summary>
/// Gets the limb mapping for the effector type.
/// </summary>
public IKMappingLimb GetLimbMapping(FullBodyBipedEffector effector) {
switch(effector) {
case FullBodyBipedEffector.LeftShoulder: return limbMappings[0];
case FullBodyBipedEffector.RightShoulder: return limbMappings[1];
case FullBodyBipedEffector.LeftThigh: return limbMappings[2];
case FullBodyBipedEffector.RightThigh: return limbMappings[3];
case FullBodyBipedEffector.LeftHand: return limbMappings[0];
case FullBodyBipedEffector.RightHand: return limbMappings[1];
case FullBodyBipedEffector.LeftFoot: return limbMappings[2];
case FullBodyBipedEffector.RightFoot: return limbMappings[3];
default: return null;
}
}
示例11: OnInteractionRelease
private void OnInteractionRelease(
FullBodyBipedEffector effectorType,
InteractionObject interactionObject)
{
if (this.InteractionRelease != null)
this.InteractionRelease(effectorType, interactionObject);
}
示例12: GetInteractionObject
/// <summary>
/// Gets the current interaction object of an effector.
/// </summary>
public InteractionObject GetInteractionObject(FullBodyBipedEffector effectorType)
{
if (!IsValid(true)) return null;
for (int i = 0; i < interactionEffectors.Length; i++) {
if (interactionEffectors[i].effectorType == effectorType) {
return interactionEffectors[i].interactionObject;
}
}
return null;
}
示例13: StopInteraction
/// <summary>
/// Stops the interaction of an effector.
/// </summary>
public void StopInteraction(FullBodyBipedEffector effectorType)
{
if (!IsValid(true)) return;
for (int i = 0; i < interactionEffectors.Length; i++) {
if (interactionEffectors[i].effectorType == effectorType) interactionEffectors[i].Stop();
}
}
示例14: OnInteractionStop
// Called by the interaction system
private void OnInteractionStop(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {
if (effectorType != this.effectorType || interactionObject != this.interactionObject) return;
inTouch = false;
}
示例15: Apply
// Apply the curve to the specified solver, effector, with the value and weight.
private void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, WeightCurve.Type type, float value, float weight) {
switch(type) {
case WeightCurve.Type.PositionWeight:
solver.GetEffector(effector).positionWeight = Mathf.Lerp(solver.GetEffector(effector).positionWeight, value, weight);
return;
case WeightCurve.Type.RotationWeight:
solver.GetEffector(effector).rotationWeight = Mathf.Lerp(solver.GetEffector(effector).rotationWeight, value, weight);
return;
case WeightCurve.Type.PositionOffsetX:
solver.GetEffector(effector).position += (positionOffsetSpace != null? positionOffsetSpace.rotation: solver.GetRoot().rotation) * Vector3.right * value * weight;
return;
case WeightCurve.Type.PositionOffsetY:
solver.GetEffector(effector).position += (positionOffsetSpace != null? positionOffsetSpace.rotation: solver.GetRoot().rotation) * Vector3.up * value * weight;
return;
case WeightCurve.Type.PositionOffsetZ:
solver.GetEffector(effector).position += (positionOffsetSpace != null? positionOffsetSpace.rotation: solver.GetRoot().rotation) * Vector3.forward * value * weight;
return;
case WeightCurve.Type.Pull:
solver.GetChain(effector).pull = Mathf.Lerp(solver.GetChain(effector).pull, value, weight);
return;
case WeightCurve.Type.Reach:
solver.GetChain(effector).reach = Mathf.Lerp(solver.GetChain(effector).reach, value, weight);
return;
case WeightCurve.Type.Push:
solver.GetChain(effector).push = Mathf.Lerp(solver.GetChain(effector).push, value, weight);
return;
case WeightCurve.Type.PushParent:
solver.GetChain(effector).pushParent = Mathf.Lerp(solver.GetChain(effector).pushParent, value, weight);
return;
}
}