- Home /
How to avoid gameObjects mixing/clipping with each other?
Hello all,
EDIT: I've been adviced to animate the whole scene and thus be in control of the avatar movement/ collision. Is that a good approach?
EDIT: Still looking for solution. I've tried:
Navmesh Obstacle, very small one, on the carts - but it's too costly and the Navmesh Agents are rigid about it.
Navmesh agent on each cart! but the cart will lose its rotation and I can't have it at the right rotation...
agent.UpdateUpAxis
doesn't seem to work for me, although it was eccepted as the right answer in one of the answers.Tried having a cube in the cart, and a rigid body and in Import I've selected the Generate Collider.
I'm not giving up on this... still looking for help.
There must be a solution to this problem. It's happening to each of us who builds game/simulation! It's trivial and I must be missing here something obvious! Please see the picture for reference. ![alt text][1]
The first image is taken from here. Can you see how nicely they hold hands? And I can't have the two carts not to collide... How hard can it be? In my photo you can see how the two carts are inside each other, and avatars hand is inside other avatar head. ***bigger radius of agent will not work for me here.
@Adam-Buckner , @$$anonymous$$ike-Geig
Sorry for tagging you guys but I really need to solve this problem... I've been advised to check Generate Collider in import settings and to use I$$anonymous$$. You must have experienced this before.
Answer by FlaSh-G · Jul 06, 2017 at 04:15 PM
The image from tomb raider shows a scripted animation. You can easily put two objects beside each other without them clipping. Your second image however seems to be from a situation where the object positions are dynamically calculated based on ... anything, really. So you cannot really compare the two images to each other.
Ther is, however, a simple solution to your problem: Make the NavMeshAgent radius big enough to contain the cart.
Hi there @FlaSh-G I can't make the radius bigger, I mean I can but then my avatars will be stuck. $$anonymous$$y environment is a room like scaled, with little place for walking.
Use any I$$anonymous$$ solution to control limbs even after they have been affected by animations.
Hi @Cherno , I can put an I$$anonymous$$ and have a raycast, and set that if the raycast hits anythig with a collider than it has to avoid it and then the hand will have to be pulled back or fold, right?
Answer by NorthStar79 · Jul 31, 2017 at 11:07 AM
hey , you can add colliders and rigidbody to carts , and also a joint for attaching them to players hand, you can combine this with IK animation solutions.
@NorthStar79 there is a collider and a rigidbody on the cart. I've jointed the cart to the avatar with I$$anonymous$$. but when I put I$$anonymous$$ on the other hand that is not holding the cart, it wont let the animation play, because the hand is restricted to the I$$anonymous$$.
oh, i see your problem I guess, can you try to lower the weight of hand in I$$anonymous$$ settings.
Answer by Eco-Editor · Aug 03, 2017 at 11:40 AM
Hello all, Quick update on solving this question... after posting and asking on Facebook various groups, forums, unity forum, @Jasper-Flick, and here of course, I've bought an asset, that uses a script with a similar logic of ray casting to avoid dynamic obstacles. It seems to be doing the work. I need to research a bit farther but if you need a link, no problem.
Regarding the carts entering the shelfs, I've limited their placement by mathf.clamp. I'ts not perfect but better.
Your answer
Follow this Question
Related Questions
How to Destroy gameObjects and deal damage within a radius except player ? 2 Answers
Im having trouble making my character throw a gameobject 1 Answer
Can You Convert a Transform into an Image? 2 Answers
How to change one child object to another with the same armature? 0 Answers
How can I set a GameObject variable on an instantiated object? (It always instantiates empty!) 1 Answer