I’d like to take this script from “decent” to “Phenomenal” and i’d like some help with this.
no, i’m not asking you to finish this script for me, more along the lines of pointing me towards the right direction to kick it up a notch and turning it into one of those “holy hell, this is stellar” scripts.
and no, i do not plan on taking this and selling it on the asset store (i’ve noticed that that tends to happen nowadays.) that being said, i’d like to make this a “free for the public to use” script.
reason? well, i cannot claim credit for all of it since it was cobbled together from scripts here and on unity answers (and since i can’t claim full credit, it’s immoral for me to turn around and sell it as it is.)
it is a basic “top down” script. it keeps the rotational information but the position information is what drives it.
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
public GameObject player;
//The offset of the camera to centrate the player in the X axis
public float offsetX = -5;
//The offset of the camera to centrate the player in the Z axis
public float offsetY = 0;
public float offsetZ = 0;
//The maximum distance permited to the camera to be far from the player, its used to make a smooth movement
public float maximumDistance = 2;
//The velocity of your player, used to determine que speed of the camera
public float playerVelocity = 10;
private float movementX;
private float movementZ;
private float movementY;
// Update is called once per frame
void Update ()
{
movementX = ((player.transform.position.x + offsetX - this.transform.position.x))/maximumDistance;
movementY = ((player.transform.position.y + offsetY - this.transform.position.y))/maximumDistance;
movementZ = ((player.transform.position.z + offsetZ - this.transform.position.z))/maximumDistance;
this.transform.position += new Vector3((movementX * playerVelocity * Time.deltaTime), (movementY * playerVelocity * Time.deltaTime), (movementZ * playerVelocity * Time.deltaTime));
}
}
so, how can we make this into a stellar script from a “passable” script? can we collaborate like we all used to before the asset store opened and before people were more mindful of turning a profit than they were about helping the community like it used to be?
that being said, since i have put some of my sweat into this, you are not permitted to just take it and sell it on the asset store (i’m not stupid, i’ve noticed that this has been happening.) i mean, really… we all collaborated and made a really sweet WoW style MMO camera system, how about we all pitch in and make a stellar “topdown shooter/diablo” style camera script too?
so, taking a look over the code, what features would you put in to make it better than it is already? one feature i’m thinking is detecting wether the camera is obscured by an object and trucking in to compensate (i think casting a ray and calculating that would be it) but i’d also like to make that feature dependant on a checkbox (such as “override collission detection” in the inspector.)
also, for those that have it, i would like to make this compatable with playmaker so that it can be used as an action. if it gets to the “this is awesome” state, i’d like to submit it to Hutong games to be included as a camera controller action.