how do i make that when i press space bar i change from character 1 to character 2 (and also change camera)
like i have bob and bub i am playing with bob cant jump over the wall so i press space and then i am bub ,bub runs too the wall space again i jump with bob on bub and bob can go over it
could someone help me ?
What have you got so far?
this:
(just my normal walk script)
var speed = 6.0;
var jumpSpeed = 8.0;
var gravity = 20.0;
private var moveDirection = Vector3.zero;
private var grounded : boolean = false;
function FixedUpdate() {
if (grounded) {
// We are grounded, so recalculate movedirection directly from axes
moveDirection = new Vector3(Input.GetAxis(“Horizontal”), 0);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (Input.GetButton (“Up”)) {
moveDirection.y = jumpSpeed;
}
}
// Apply gravity
moveDirection.y -= gravity * Time.deltaTime;
// Move the controller
var controller : CharacterController = GetComponent(CharacterController);
var flags = controller.Move(moveDirection * Time.deltaTime);
grounded = (flags CollisionFlags.CollidedBelow) != 0;
}
//If player enters the room set a higher gravity
function OnTriggerEnter(col : Collider){
if(col.name == “Room”){
gravity -= 4;
}
}
//As soon as player exits the room set a different gravity
function OnTriggerExit(col : Collider){
if(col.name == “Room”){
gravity += 4;
}
}
@script RequireComponent(CharacterController)
Edit: it is more like a script change like first i control p1 and the p2 (i need more scripts i know (just copy))