Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q 4 ( 2 0 p ) . What does the following script do ? Script is attached to an active cube game object located
Qp What does the following script do Script is attached to an active cube game object located on a plane.
using UnityEngine;
public class Test : MonoBehaviour
float rSpeed;
Vector dir Vectorzero;
float mSpeed ;
void Update
if InputGetKeyKeyCodeMouse
Ray ray Camera.main.ScreenPointToRayInputmousePosition;
RaycastHit hit;
if PhysicsRaycastrayorigin, ray.direction, out hit
dir hit.point;
transform.position VectorLerpcubeposition, hit.point, mSpeed Time.deltaTime;
Quaternion rot QuaternionSetLookRotationdir;
transform.rotation Quaternion.Lerpcuberotation, rot, rSpeed Time.deltaTime;
YOUR ANSWER HERE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started