//allows developer to specify the type of collidable object to be used as basis for the camera public CollidableFirstPersonCameraController(string id, ControllerType controllerType, Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed, ManagerParameters managerParameters, IActor parentActor, float radius, float height, float accelerationRate, float decelerationRate, float mass, float jumpHeight, Vector3 translationOffset, PlayerObject collidableObject) : base(id, controllerType, moveKeys, moveSpeed, strafeSpeed, rotationSpeed, managerParameters) { this.Radius = radius; this.height = height; this.AccelerationRate = accelerationRate; this.DecelerationRate = decelerationRate; this.Mass = mass; this.JumpHeight = jumpHeight; //allows us to tweak the camera position within the player object this.translationOffset = translationOffset; /* Create the collidable player object which comes with a collision skin and position the parentActor (i.e. the camera) inside the player object. * notice that we don't pass any effect, model or texture information, since in 1st person perspective we dont want to look from inside a model. * Therefore, we wont actually render any drawn object - the effect, texture, model (and also Color) information are unused. * * This code allows the user to pass in their own PlayerObject (e.g. HeroPlayerObject) to be used for the collidable object basis for the camera. */ if (collidableObject != null) { this.playerObject = collidableObject; } else { this.playerObject = new PlayerObject(this.ID + " - player object", ActorType.CollidableCamera, (parentActor as Actor3D).Transform, null, null, this.MoveKeys, radius, height, accelerationRate, decelerationRate, jumpHeight, translationOffset, this.ManagerParameters.KeyboardManager); } playerObject.Enable(false, mass); }
public CollidableFirstPersonController(string id, ControllerType controllerType, Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed, float radius, float height, float accelerationRate, float decelerationRate, float mass, Vector3 translationOffset, Actor3D parentActor) : base(id, controllerType, moveKeys, moveSpeed, strafeSpeed, rotationSpeed) { this.radius = radius; this.height = height; this.accelerationRate = accelerationRate; this.decelerationRate = decelerationRate; this.mass = mass; this.translationOffset = translationOffset; this.playerObject = new PlayerObject(this.ID + " - player object", ActorType.CollidableCamera, parentActor.Transform3D, null, Color.White, 1, null, null, this.MoveKeys, radius, height, accelerationRate, decelerationRate, translationOffset); playerObject.Enable(false, mass); }