After applying my dropper script to my object, recreating it, reapplying the Collider and Rigidbody, it just keeps dropping after hitting the ground! It passes right through and keeps going. I verified my player object and walls all have Rigidbody and are not falling. Just the dropper cube object. I am not sure how to properly troubleshoot and fix this. Very annoyed. Any ideas?
Can you share the script with us?
Also make sure that you have not activated the Is Trigger
option for the collision component, as this could be the cause of your object passing through walls or disabling the collision component
Well, I certainly can. However, I fixed this a few hours ago. All I did was move the object around in the Unity editor and it started working as expected! My test was to see if moving it closer to the ground was going to affect it (if velocity was somehow allowing it to pass). However, after verifying it did not penetrate the ground object after moving next to it every height a placed it thereafter worked fine! Kind of felt like recalculating particle physics in Blender…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dropper : MonoBehaviour
{
MeshRenderer renderer;
Rigidbody physics;
[SerializeField] int timeToWait = 3;
// Start is called before the first frame update
void Start()
{
renderer = GetComponent<MeshRenderer>();
physics = GetComponent<Rigidbody>();
renderer.enabled = false;
physics.useGravity = false;
}
// Update is called once per frame
void Update()
{
if ((Time.time > timeToWait) && (physics.useGravity == false) && (renderer.enabled == false))
{
renderer.enabled = true;
physics.useGravity = true;
}
}
}
Glad you fixed it by just moving the object around in the editor
In view of the circumstance you put forward, it is hard to pinpoint the cause of this, some minor bugs in the editor perhaps (in which case a restart might help) or perhaps there’s something I might have misunderstood
Regardless, I’m glad you were able to fix it
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.