Experiment 3 Cu
Experiment 3 Cu
1.2 Objective:
In this experiment, the 2D rigid body transformation is analyzed. A 2D rigid body
object transformation in Unity involves manipulating its position, rotation, and scale
while taking into account the physics simulation.
1.4 Description: Install the Unity's C# scripting language and execute the following codes
to analyize the rigid body transformation
using UnityEngine;
void Update()
{
// Move horizontally and vertically based on user input
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
using UnityEngine;
void Update()
{
// Rotate based on user input
float rotationInput = Input.GetAxis("Rotation");
using UnityEngine;
void Update()
{
// Scale based on user input
float scaleInput = Input.GetAxis("Scale");
using UnityEngine;
void Update()
{
// Move horizontally based on user input
float horizontalInput = Input.GetAxis("Horizontal");
Vector2 translation = new Vector2(horizontalInput, 0f) * moveSpeed *
Time.deltaTime;
transform.Translate(translation);
Viva Questions: