Hello community,
i’m working on a visualisation set and i have to be able to add and move some object in it.
actually i have attached to an empty gameobject some toggle script to make object appear.
i also have on each concerned game object a transform script to be able to move them in my set.
works nice but i need to be able to deactivate the transform script on some objet like
example i have a boat i place it in my set at a desirable spot and need to put my character on it.
i use this simple script to make them move
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TransformFunctions : MonoBehaviour
{
public float moveSpeed = 10f;
public float turnSpeed = 50f;
public float climbSpeed = 5f;
void Update()
{
if (Input.GetKey(KeyCode.Keypad8))
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.Keypad2))
transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.Keypad7))
transform.Translate(-Vector3.right * moveSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.Keypad9))
transform.Translate(Vector3.right * moveSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.Keypad4))
transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.Keypad6))
transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);
if (Input.GetKey(KeyCode.KeypadPlus)) {transform.position += transform.up * climbSpeed * Time.deltaTime;}
if (Input.GetKey(KeyCode.KeypadMinus)) {transform.position -= transform.up * climbSpeed * Time.deltaTime;}
}
}
my probleme is for now, i have to desactivate the boat to move my character if not, both will move so its too much complicated to work with.
considering that i must be able to move my camera to go anywhere i want.
so i need an idea of how to freeze a choosen object without hiding and being able to move another.
any idea ?
thanks by advance