Do not know to have clear, wish the great spirit of all stripes,
Here is a snippet of code, the change of the triggering event is a Boolean value, but how will the change of the Boolean value in b as a condition of moving?
void the Update ()
{
//the transform. The position=new Vector3 (Mathf. Lerp (+ 82.5 f - v * Time. Time, - v * Time. The Time + 82.5 f, Time, Time), 0.5 f, 0).
//using the keyboard control object motion, only in x axis direction
Float x=Input. GetAxis (" Horizontal ");
Float z=Input. GetAxis (" Vertical ");
Vector3 move=new Vector3 (0.5 x, f, z);
* maxSpeed rigidbody. AddForce (move);
}
Private void OnTriggerEnter (starts other)
{
If (other. GameObject. CompareTag (" pick "))
{
Flag=false;
}
}
CodePudding user response:
A mount object script only writing AScript code after pressing the keyboard A motion object functionObject B BScript mount script code only write object B movement function
CScript object C (i.e., the trigger) mount script code to realize the triggering function, OnTriggerEnter, determine the contact object is A, is A call the script BScript movement function
CodePudding user response:
Please post the main adopted, please, where is not clear just ask me,CodePudding user response:
Thank you, but do you have any questions, I how cscript invokes the function of bscript?CodePudding user response:
https://www.jianshu.com/p/29205af886bfCodePudding user response:
The third: GameObject. Find (" script in the object name "). GetComponent<script name & gt; () function name (); This method can be invoked only public type functionCodePudding user response:
Call each other between different script was very basic knowledge, you can find a video courses have a look