Hello, I am in great need for a script that is a 3rd person view and can drive/hover around in a map. It should be able to turn/rotate by following the position of the mouse (only side to side not up and down) and going forward, reverse, with “W” and “S”
And if its possible I am also in great need of a script for entering and exiting the ship.
In return, if you help me with the script I will return the favor of some models that you need, or some art work, like textures (still learning GIMP though)
My script is more simple, easier to modify… Not to put down your project lol.
The script I posted is exactly what he wanted, I think he needed a script he didn’t need to modify to suit his needs. Some times simple gets the job done.
I will mention you in the credits, as for the models just PM me and I will send whatever ones you want, but all I ask is to put me in the credits that you are using it for, and do not sell them.
Also, one little problem (or big not good with scripting) When I push W or S it does not move.
But when I push A or D it just goes around in a circle. (around the x-axis not the y-axis)
And the ship does not turn if I move the mouse.
var car : Transform;
var player : Transform;
var exitPoint : Transform;
var doorTriggerLeft : Transform;
var PlayerCamera : Camera;
var ShipCamera : Camera;
var isPlayerVisible : boolean;
function Update(){
if (Input.GetKeyUp("e") isPlayerVisible){
// make player invisible and still standing
player.gameObject.SetActiveRecursively(false);
player.gameObject.active = false;
// parent player to Exit Point
player.parent = exitPoint.transform;
player.transform.localPosition = Vector3(-1.5,0,0);
// parent PlayerParent to car
exitPoint.parent = car.transform;
exitPoint.transform.localPosition = Vector3(-0.5,0,0);
// Enable Car as controllable object
GameObject.Find("ship").GetComponent("ShipMove").enabled=true;
PlayerCamera.enabled = false;
CarCamera.enabled = true;
}
else
{
if (Input.GetKeyUp("x")){
// make character visible again --- this happens when the x button is pressed.
player.gameObject.SetActiveRecursively(true);
player.gameObject.active = true;
// unparent player from everything
player.transform.parent = null;
// parent Exit Point to door Trigger-- the door trigger is the door to the ship, pretty much.
exitPoint.parent = doorTriggerLeft.transform;
// disable car as controllable-- making the player controllable
GameObject.Find("ship").GetComponent("ShipMove").enabled=false;
PlayerCamera.enabled = true;
ShipCamera.enabled = false;
}
}
}
function OnTriggerEnter(Player : Collider) {
isPlayerVisible = true;
}
function OnTriggerExit(Player : Collider) {
isPlayerVisible = false;
}
You should change the “shipmove” to whatever you saved the first script as, and should change the “ship” to whatever you named the ship in your game. Then create a trigger for the door, and an exit point. After this, assign the trigger for the door and the exit point to the slots in the editor. This script should be attached to the ship.
you can cast a ray from the main camera to the mousepoint on the screen, then get a point on that ray at a certain distance, then you can make your hovercraft LookAt that point’s coordinates (this will rotate your hovercraft based on mouse movement)
and for the WS controlls you can use the script Philip gave you to move forward or backwards, this part: