Unity Collider Not Moving With Parent
Rigidbodies do not inherit forces/velocity from parent rigidbodies. They act independently. You could apply the move position to both, but there's always the possibility that the child will hit the parent when trying to do that. You could use FixedJoint to keep them together (might need to unchild it), but it depends on what you're trying to accomplish. FixedJoint would really keep them together, but if you want the child to also be able to move on it's own but move with the parent as well, then you might want to take a look at other joint types and see what works best for what you want.
unity collider not moving with parent
ParentingWhen an object is under physics control, it moves semi-independently of the way its transform parents move. If you move any parents, they will pull the Rigidbody child along with them. However, the Rigidbodies will still fall down due to gravity and react to collision events.
Not sure FixedJoint is going to help much as I want the child to move horizontally independently of the parent. So odd, though, I could have sworn I had similar behaviour working with a character standing on a moving platform...
The doc is confusingly worded. I believe it's saying if you move the parent's transform it will move the child's transform as well, but moving the parent rigidbody will not move the child's rigidbody. You can google "unity parent rigidbody not moving child" and you'll find a lot of people with similar issues to you who also have a rigidbody on the child. For what you describe I'd do my first suggestion. Keep it childed. On the parent, assign the child rigidbody in the inspector. Then when you add forces to the parent, add them to the child too. It should work well for what you're trying to accomplish.
So I got back into unity after 3 years so I'm pretty much beginning again from scratch. I'm making a game where you throw a spear at a block and when you hit the block it should output win in the debug.log. however I noticed my collider isn't even moving along with my object. In order to make the spear fall realistically I made it out of 3 different parts with different weights and it works like a charm. I wanted to add the boxcollider to the tip of the spear but then found out that the OnCollisionEnter does not work on children for some reason so i put a rigidbody and a collider on the parent. but when I apply a force on the Handle the spear flies away nice and easy but the box collider that I put on the spear stays behind .
o wow, I've been fiddling with this for hours and right after posting I found a solution. I added a fixed joint between the parent (spear) and the child (handle) (I putted the fixed joint component on the parent). That way the parent moves along with the child
I have considered moving a parent object (with its X and Z axis locked) and having the collider/mesh (and possibly a rigidbody) on a child object. I was hoping I could get Unity to handle the ship/craft collisions, but although it might seem an easier option now, it does make the flight model more complicated overall.
Can I rotate the collider/mesh of an object with a rigibody, using force in the global z and y (plus rotation in the global Y) and still be able to use Unity's physics to handle most collisions or should I just use an object with a trigger collider and handle all my own collisions and movements and leave Unity to handle any other game objects with colliders (and rigidbodies where needed)?
Compound colliders approximate the shape of a GameObject while keeping a low processor overhead. To get further flexibility, you can add additional colliders on child GameObjects. For instance, you can rotate boxes relative to the local axes of the parent GameObject. When you create a compound collider like this, you should only use one RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More infoSee in Glossary component, placed on the root GameObject in the hierarchy.
Primitive colliders do not work correctly with shear transforms. If you use a combination of rotations and non-uniform scales in the Transform hierarchy so that the resulting shape is no longer a primitive shape, the primitive collider cannot represent it correctly.
The benefit of this is that a convex mesh collider can collide with other mesh colliders so you can use this feature when you have a moving character with a suitable shape. However, a good rule is to use mesh colliders for sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More infoSee in Glossary geometry and approximate the shape of moving GameObjects using compound primitive colliders.
When colliders interact, their surfaces need to simulate the properties of the material they are supposed to represent. For example, a sheet of ice will be slippery while a rubber ball will offer a lot of friction and be very bouncy. Although the shape of colliders is not deformed during collisions, their friction and bounce can be configured using Physics Materials. Getting the parameters just right can involve a bit of trial and error. A slippery material like ice, for example, has zero (or very low) friction. A grippy material like rubber has high friction and near-perfect bounciness. See the reference pages for Physic Material and Physics Material 2D for further details on the available parameters. Note that for historical reasons, the 3D asset is actually called Physic MaterialA physics asset for adjusting the friction and bouncing effects of colliding objects. More infoSee in Glossary (without the S) but the 2D equivalent is called Physics Material 2DUse to adjust the friction and bounce that occurs between 2D physics objects when they collide More infoSee in Glossary (with the S).
On the first physics update where the collision is detected, the OnCollisionEnter function is called. During updates where contact is maintained, OnCollisionStay is called and finally, OnCollisionExit indicates that contact has been broken. Trigger colliders call the analogous OnTriggerEnter, OnTriggerStay and OnTriggerExit functions. Note that for 2D physics, there are equivalent functions with 2D appended to the name, eg, OnCollisionEnter2D. Full details of these functions and code samples can be found on the Script Reference page for the MonoBehaviour class.
In particular cases, the physics engine optimizes for static colliders that never move. For instance, a vehicle resting on top of a static collider remains asleep even if you move this static collider. You can enable, disable, or move static colliders in runtime without specially affecting the physics engine computation speed. Also, you can safely scale a static Mesh Collider as long as the scale is uniform (not skewed).
This is a GameObject with a Collider and a normal, non-kinematic Rigidbody attached. Rigidbody colliders are fully simulated by the physics engine and can react to collisions and forces applied from a script. They can collide with other objects (including static colliders) and are the most commonly used Collider configuration in games that use physics.
Yes, if you add your box entity with the collider as a child to that bone node. Just make sure to avoid adding a rigid body to that entity unless you are using a kinematic object and you know what you are doing with that.
In my model's case I want hair, breast and skirt bones. A good thing to do is parent the bones so you can then apply one Dynamic Bones script to each parent bone to move all the children. This is not necessary in theory but you would have to exclude the bones in Unity and you can end up with unexpected results as well.
To parent the bones click on the armature and choose Edit mode. Select all the parent bones of the bones you want to use with the dynamic bone script. Select the root bone last and then right-click it again. Choose Parent -> Make and then choose Keep Offset. This will move all the selected bones and their children under the root bone you chose while keeping them placed where they were. Do this for all the other group of bones (skirt, breasts etc.).
In order for the Dynamic Bone script to work with the colliders you will have to add them to it. Click on the root of your avatar and in the component set size under Colliders. Then drag the bones with the colliders attached to the fields that will show up (in my case Hips, Left Leg and Right Leg).
In a 2D scene, you must attach 2D shape colliders with names like CircleCollider or BoxCollider2D. Similarly, in a 3D game, you must attach 3D colliders such as BoxCollider, SphereCollider, MeshCollider or a CapsuleCollider to your object.
When attaching a particle very close to or inside a collider (so that they overlap), if you have collision constraints enabled you can encounter a situation in which the attachment and collisions fight each other. This results in jittering and/or an undesired offset in the attachment position, because particles cannot simultaneously be inside and outside the collider. If the attachment is dynamic, results will be even worse as this setup causes a force feedback loop between the particles and the rigibody with largely undefined behavior.
The solution is to use categories and masks to filter out collisions between the pinned particle and the collider. See the collisions page for more information on how to set up collision filtering. By setting the particles and collider to different categories and disallowing collisions between them, no contacts will be generated between them and collisions will not interfere with attachments.
You can also nest canvases, which allows designers to create large hierarchical UIs without having to think about where different things are onscreen across many canvases. Child canvases also isolate content, from both their parent and sibling canvases. They maintain their own geometry and perform their own batching. 041b061a72