I've set up this enemy to turn into a ragdoll upon death, fly into the air a bit, and behave like a ragdoll. It is all working fine as far as i can tell.
Except i am encountering an issue where the enemy keeps popping in and out of existence, depending on the cameras rotation/position.
Here is what it looks like before the issue.
Then, from this position, if i rotate the camera slightly, it results in this:
The game is paused while this is happening so it is not related to movement in any way. I can also rotate the camera back and forth, and the model will continue to pop in and out of existence. No gameobject is being destroyed.
It it also nothing to do with the model clipping into / under the floor, as you can see in the pictures, i raised it up off the floor to test it, and it still happens while suspended in mid-air.
This issue only happens while the enemy is a ragdoll. If i turn off ragdoll deaths nothing like this ever happens.
Do you have any idea what could be causing something like this?
I am guessing that your enemy is using the skinned mesh render component. When using ragdolls and skinned mesh renders together the bones or vertices of the rig might get pushed out of bounds. Unity only renders your mesh if the bounds of it are in the camera view. The unity docs recommend either increasing the bounds or turning on "Update When Offscreen" on all of your skinned mesh renderers.
More info here
Related
click here for gif show of what I want
I want to remove mesh of object when user click on object and also remove its collider to make another object fall from that removed mesh area...
I am using unity since last month so I don't have much experience and knowledge, please help me...
Creating the destructable ground particles
One way to achieve whats shown in the gif is by creating a prefab of e.g. a circle collider that is instantiated in the area of where the dirt is in your gif. It acts as a "ground particle" and keeps the objects above itself.
You instantiate a lot of them in the area so it acts as a big collider although it is actually a whole array of smaller colliders.
Implementing the interaction logic and deactivating the ground particles
Ater that you implement the functionality of dragging the mouse over the ground particles, removing them. That is also not difficult. Shoot raycasts into the screen at the postition of the mouse (remember to use Camera.ScreenToWorldPoint) and get the collision information (confer to https://docs.unity3d.com/ScriptReference/Collider2D.Raycast.html). With the collision information you can get the reference to the instance of your ground particle(raycasthit.other.gameobject) which is then disabled through script(gameobject.setActive(false)).
Hi I'am new to Unity and I was trying to implement a game using tetris blocks.
The game's goal is to build the highest tower before it collapses. However there is a problem in my implementation which is seen in the picture below.
I achieve the building a tower task by activating the rigidbody gravityscale when it collides with something. With that way it can collapse after touching somewhere not before. But I want to have the flexibility of some collisions. In the situation seen in the picture below, that 'T' block will collide with the point in the red circle before landing safely and gravityscale of the rigidbody will be set. So it will drop but I don't want it to happen becasue the collision area is too small. I want to make it land safely with some flexibility.
I tried to make colliders' size 0.9 but that just disrupts the scale of the world.
Can I do something like this :
If collision happens, check collision area and if the area is lower than lets say 0.1, do not trigger rigidbody gravityscale.
what about using capsulle collider 2D with small radius?
I have a Sphere that is a child. The problem is that in the game I see it in front of the camera and I don't want to see it but still want to use.
If I uncheck and disable the Mesh Renderer component it might make the Sphere not working as what it needed for ?
No. The mesh renderer only draws the object in the scene, if it's disabled it will stop drawing it. Everything else will still work: if it has a collider it can collide or be clicked on, if it has a rigid body it will have certain physical properties, it will be found if you call Object.FindObjectOfType(), and so on.
Now it's a different story if you disable its game object.
Im not even sure what is happening here but I'm just trying to make objects fall normally onto the floor - they need gravity/be able to be pushed around, but just fall onto a static floor object.
I have a cube and my floor mesh. Floor mesh has this:
Cube has this:
Initially I'll have my cube just positioned right over the floor. Then I press play and pause, within one second it's 100 m away, spinning/falling. What could be happening here?
You may face problems with small size colliders due to how the physics engine works. Increase size of colliders and see if it helps. If you really need colliders this small, try changing the Default Contact Offset in Physics Manager.
I placed a light in my scene.
It is lighting the ground when i'm facing that light but when I turn the opposite direction, the light on the ground vanishes.
I think this might be some Unity's default behaviour.
Is there a way I can solve this issue?
Unity uses frustum culling to save performance, so it only draws items that are within the camera's viewing area. As a result of this, the particles behind you are not drawn, and any lights attached to them aren't either.
Scene-crucial lights aren't normally attached to particles, so it's normally not a concern if they're hidden along with their particles.
For conventional lights (not attached to particles), Unity should render the light as long as it affects objects within the camera frustum. If you use a conventional light, you should see better results.
Looks like you may have to disable occlusion culling. Unity3D Manual