camera and gravity help

all the scripts i got working fine except for these two

got all the scripts to work but

how do i add a camera limit in its translate z and x position so that player cant go off screen cant seem to figure this part out

hmmmmm

also how do i make playermodel fall faster from a jump as of now the fall from the jump is too slow

A simple way is making some variables in the script attached to the camera:

Js:

public var minCameraBoundsX:float;
public var maxCameraBoundsX:float;

public var minCameraBoundsY:float;
public var maxCameraBoundsY:float;

set your camera bounds

and in the FixedUpdate function:

//set transform variable for better performance
private var tr:Transform;

private function Awake():void {
    tr = transform;
}

private function FixedUpdate():void {
    //camera bounds
    transform.position.x = Mathf.Clamp(transform.position.x, minCameraBoundsX, maxCameraBoundsX);
    transform.position.y = Mathf.Clamp(transform.position.y, minCameraBoundsY, maxCameraBoundsY);
}

I’m not sure but try to use FixedUpdate to update the camera following a rigidBody to better synchronization.

About the player bounds u can use some box coliders.

To fall faster u can increase the gravity in Edit/ Projet Settings/ Physics.

Luis.

didnt work hmmmm