I’ve created an object that is supposed to move a command happens. The command happens, I have tested it multiple times, but the object doesn’t move. The object is a child, Kinematic, and the parents is Kinematic as well. Here’s the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class openingPipeTop : MonoBehaviour
{
public bool topPipeOpening = false;
public int topPipeOpeneningSpeed = 3;
public Rigidbody2D pipeTopRigidbody;
private float timer;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (topPipeOpening == true)
{
openTopPipe();
}
{
timer = timer + Time.deltaTime;
}
}
[ContextMenu(“OpenPipe”)]
public void openTopPipe()
{
pipeTopRigidbody.velocity = Vector2.up * topPipeOpeneningSpeed;
Debug.Log(“TopPipeHasBeenOpened!”);
}
}
I have the rigidbody connected to the script, so what is the issue?