Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Squeeze Softbody
#1
Hi,

I have 2 different scale car. I want the small one to pass between the rollers but I don't want the big one to pass. Unfortunately, both of them are passing. How can I do that?

   

   
Reply
#2
(10-01-2023, 03:35 PM)patriot4947 Wrote: I have 2 different scale car. I want the small one to pass between the rollers, but I don't want the big one to pass. How can I do that?

Depends on how your rollers are implemented.

To do this in a physically simulated way, you must make sure the rollers are actuated using motorized hinge joints. Then, adjust the motor force (torque) so that the size and mass of the large object are too much for the motor to deal with.

If you just rotate the rollers manually, they'll be able to pull any object/body.

cheers!
Reply
#3
(10-01-2023, 03:38 PM)josemendez Wrote: Depends on how your rollers are implemented.

To do this in a physically simulated way, you must make sure the rollers are actuated using motorized hinge joints. Then, adjust the motor force (torque) so that the size and mass of the large object are too much for the motor to deal with.

If you just rotate the rollers manually, they'll be able to pull any object/body.

cheers!

How can I do that with hinge joint. Can you explain a little more
Reply
#4
(10-01-2023, 04:01 PM)patriot4947 Wrote: How can I do that with hinge joint. Can you explain a little more

Sure, simply add a HingeJoint component to your rollers, enable their "motor" checkbox, set a target velocity (the velocity at which they should rotate) and a motor force (the torque applied to make them rotate).

This should be trivial to do. If you're unfamiliar with physics in general I'd advise to get used to built-in rigidbodies and joints before moving on to softbodies. Otherwise you'll be in for a really steep learning curve, since softbodies are considerably more complex than rigidbodies.

cheers,
Reply
#5
(10-01-2023, 04:06 PM)josemendez Wrote: Sure, simply add a HingeJoint component to your rollers, enable their "motor" checkbox, set a target velocity (the velocity at which they should rotate) and a motor force (the torque applied to make them rotate).

This should be trivial to do. If you're unfamiliar with physics in general I'd advise to get used to built-in rigidbodies and joints before moving on to softbodies. Otherwise you'll be in for a really steep learning curve, since softbodies are considerably more complex than rigidbodies.

cheers,
 I have added but it doesn't turn now.

   
Reply
#6
(10-01-2023, 04:19 PM)patriot4947 Wrote:  I have added but it doesn't turn now.

A target velocity of 1 is extremely small. So is the target force.

Velocities are expressed in degrees/second, use something like 90.
Reply
#7
(10-01-2023, 04:23 PM)josemendez Wrote: A target velocity of 1 is extremely small. So is the target force.

Velocities are expressed in degrees/second, use something like 90.

It doesn't work. All settings are below.

   
   
   
Reply
#8
(10-01-2023, 04:31 PM)patriot4947 Wrote: It doesn't work. All settings are below.

It should, I just tried the same settings on a cylinder and it rotates fine (just had to adjust the joint axis so that it rotates around the correct axis). Your screenshot shows that the rigidbody’s angular velocity is 0.49 rads/sec on the Y axis, so it should be rotating for you too? is the rotation not visible?

Make sure you’re not forcing rotation from any other component/script. If this happens, no matter how high the angular velocity is or how high a torque the motor applies, rotation will be forced to be a specfic value. Nevertheless, joints are standard Unity components so I’d recommend asking on the Unity forums for assistance with them.

Note though, that it is not needed to constrain the position of a rigidbody if you’re using a joint to keep it in place. You can uncheck all the position constraints on your rigidbody component.

kind regards,
Reply