GPP 6
GPP 6
Practical No. 6
Description :
Unity :
Unity is a versatile and widely-adopted game development engine that
empowers developers to create interactive experiences across multiple
platforms, including 2D and 3D games, augmented reality (AR), virtual reality
(VR), and other real-time applications. Renowned for its flexibility, user-friendly
interface, and robust feature set, Unity serves as a go-to tool for both indie
developers and large-scale studios.
Code :
using UnityEngine;
void Start()
{
if (cameraTransform == null)
{
cameraTransform = Camera.main.transform;
}
originalPosition = cameraTransform.position;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.S))
{
ShakeCamera();
T110 Rugved Shetge
if (shakeTimeRemaining > 0)
{
cameraTransform.position = originalPosition + Random.insideUnitSphere
* shakeFrequency;
shakeTimeRemaining -= Time.deltaTime;
}
else
{
cameraTransform.position = originalPosition;
}
}
Output :