Help with changing objects.

Hi,

I am working on my project for a while, and I would like to have a script.
In my game, there is a character, MAX, which is a 3rd person controller.
I also have another object, which is a car. There is a camera that views MAX, which is the main camera. It isn’t parented to MAX.
The car has a camera which is parented and can rotate around the car. The car can drive.
I would just like a script that makes sure when MAX touches the car, MAX and the main camera are deactivated, and the car is activated. And when you press enter, the other way around happens.

Object names:
MAX: MAX
Car: BMW
Main Camera: Main Camera

I hope somebody could make a script like this for me.

Thanks,
Willie

Did you ever try to learn scripting? It’s not difficult, really.

The code what you need looks something like this:

using UnityEngine;
public class Example : MonoBehaviour {

    public Camera mainCamera;
    void OnCollisionEnter(Collision collision) {

        if(collision.gameObject.name == "BMW")
        {
	        mainCamera.enabled = false;
                this.gameObject.SetActive(false);
        } 
    }
}

But I don’t understand this: “when MAX touches the car, MAX and the main camera are deactivated, and the car is activated” - Car should be inactive before MAX touch it? If it’s true, how he touch it, if car is not active?

Yes, that is true. MAX can’t touch the car when it is not there yet.
What if there is a car which cannot do anything.
There is only one camera, and the camera originally orbits around MAX.
If MAX touches that car, the car changes into a car which can drive.
And, if MAX touches the car which can drive, let’s name it drive_car, the camera orbits around that car instead of MAX.
Is that easier to make a script of?

Names:
MAX
Car which cannot drive: Car
Car which can drive: drive_car
Camera: mainCamera