/// <summary> /// Constructs the query manager for a character. /// </summary> /// <param name="character">Character to manage queries for.</param> public QueryManager(BEPUCharacterController character) { this.character = character; //We can share the real shape with the 'current' query object. this.queryObject = new ConvexCollidable <CapsuleShape>(character.Body.CollisionInformation.Shape); //Share the collision rules between the main body and its query objects. That way, the character's queries return valid results. this.queryObject.CollisionRules = character.Body.CollisionInformation.CollisionRules; this.supportRayFilter = this.SupportRayFilterFunction; }
/// <summary> /// Creates a character controller in the world /// </summary> /// <param name="characterControllerDescription"> </param> /// <returns></returns> public ICharacterController CreateCharacterController(CharacterControllerDescription characterControllerDescription) { var position = characterControllerDescription.Position; var correctedPosition = new Vector3(position.X, position.Y, position.Z); var bepuCharacterController = new BEPUCharacterController(correctedPosition, characterControllerDescription.Height - characterControllerDescription.Radius * 2f, characterControllerDescription.Radius, 1, characterControllerDescription.SlopeLimit); bepuCharacterController.Body.CollisionInformation.CollisionRules.Group = GetCollisionGroup(CollisionHelper.AvatarObjectColliderDescription.CollisionGroup); this.space.Add(bepuCharacterController); return(bepuCharacterController); }
/// <summary> /// Constructs a new support finder. /// </summary> /// <param name="character">Character to analyze.</param> public SupportFinder(BEPUCharacterController character) { this.character = character; }
/// <summary> /// Constructs a new horizontal motion constraint. /// </summary> /// <param name="characterController">Character to be governed by this constraint.</param> public HorizontalMotionConstraint(BEPUCharacterController characterController) { this.character = characterController; this.CollectInvolvedEntities(); }
/// <summary> /// Constructs a new vertical motion constraint. /// </summary> /// <param name="characterController">Character governed by the constraint.</param> public VerticalMotionConstraint(BEPUCharacterController characterController) { this.character = characterController; }