hi, i’m new! to scripting! i’ve zero knowledge on howto script! but i learn fast!
im at a roadblock, i wouldn’t be posting in the forums if i didn’t have to, but after all the wasted time now i’ve run out of time to figure this step out, and must move on, so i need to get moving!
hopefully i can get some fast help here.
and, my other question (unrelated to this topic) is what is the best way to search this forums? like how do the keywords work here, do i type in a “function” or “how to cal constantforce from another script”, because i keep getting results from all sorts of posts, it’s very very draining on me, and my time, to clik through each topic and search for my answer…i keep getting 12-18pages of results. i’m using Answers.Unity as well but the responses are not coming quick enough for me to get my work done. youtube search is not getting me anywhere much, and my past 30days have seen pretty much zero to 1% progress, in terms of the scripting…the art is doing well ahead of pace.
ok, here’s what i have now, attached to just the standard GameObject > Create > Cube, and a Component > Constant Force applied as well.
so i have:
using UnityEngine;
using System.Collections;
public class engine : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown("a")){
print("A was pressed to move left");
transform.Translate(Vector3.left * 10);
}
if (Input.GetKeyDown("d")){
print("D was pressed to move right");
transform.Translate(Vector3.left * -10);
}
if (Input.GetKeyDown("x")){
print("X was pressed");
constantForce.force = Vector3.forward * 1000;
}
}
}
on another GameObject > Cube, i set “is Trigger” to true (checked).
when the first cube passes over/through this 2nd cube, i want the “ConstantForce” value that is on the first cube to increase to a new value.
here’s what i wrote: (the comments are there because i gave up trying to fix my error and needed to save my progress and “Play” test to run, and i have no clue what the unity console is saying to me the error is).
using UnityEngine;
using System.Collections;
public class booster : MonoBehaviour {
//public GameObject target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
//void OnTriggerEnter (Collider other) {
// Boost();
//}
//private void Boost(){
//engine e = (engine)target.GetComponent<engine>();
// ConstantForce = GetComponent<engine>();
// constantForce.force = Vector3.forward * 3000;
//}
}
big thanks to anyone that can help, and fast, and thanks for reading my topic!!