I’m trying to set up an effect of hitting one object with another using an explicit drag by the user. I have 2 spheres in my scene. The first sphere I have coded drag behavior, which works great. The 2nd sphere is the object I want to hit. I’ve applied colliders and rigid bodies to both and the effect is somewhat working, but the problem is that the 2nd sphere is only getting pushed out of the way and not bouncing or reacting with the energy of the drag.
I have a physics material applied to the 2nd sphere with high bounce, which I have tested using gravity bouncing off a ground plane; it is very bouncy.
My guess is that the physics engine is not taking into account the drag velocity of the 1st sphere, so when the collision occurs it is treating it like a static object. How can I overcome this? I’d like the interaction to be fully controllable by the drag, from a gentle nudge to a hard smack.
Any ideas? Thanks.
That works, thanks! I created a new cube object and added Fixed Joint to it and moved over the drag script. The 1st sphere I left as a rigid body only (no drag) and connected it to the fixed joint.
– Steven-WalkerI ended up dropping the Fixed Joint and instead in my script I use rigidbody.MovePosition(), in place of transform.position. This caused the drag movement to affect the rigidbody velocity.
– Steven-WalkerGood call.
– roamcel