Gameobject not rotating despite code that should make it do so

I am trying to rotate an object through another script by pressing the control key

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Skateboard : MonoBehaviour
{
    public CameraScript cameraScript;
    public MovementNew script;
    public GameObject body;
    public float skateboardDuration;
    public float skateboardCooldown;
    public float skateboardDrag;
    public float skateboardSpeed;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(script.movementKey) && script.canFire)
        {
            body.transform.Rotate(-90f, 0, 0);
            Debug.Log("rotate");
        }
    }

body is a game object I created and is the capsule the player controls I want to flip onto its back

enter image description here

however whenever I run the code I get the debug message but the body doesn’t rotate at all

I commented out all of the excess code in this script leaving just the rotate and debug command but that did little to help. I tried applying the script to the body itself but that also did nothing. When put fully into action with the coroutines the code will cause the body to rotate for split seconds before jolting back to an upright position. None of my solutions have solved this issue

Leave a Comment