Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Friction on Moving Platform
#4
(31-03-2022, 08:42 PM)Oxters Wrote: I'm relatively new to Obi (just bought the assets yesterday), so there's a high chance I missed something or forgot something. When you say that the friction constraints should be globally enabled, do you mean that I should apply the Obi Collider Material to all Obi Colliders? If so then I have done that so far, but if not could you elaborate please.

As for the how and when I'm applying forces to the belt panels, I do that during the fixed update call. Here's some code to show what I'm doing:

Conveyor -> https://pastebin.com/aqExDDMW
PhysicsHelperFunctions -> https://pastebin.com/nhajtU5E

In the conveyor code you might notice I also use MovePosition and MoveRotation, but those are only called when the panels are re-initialized. So they're only called once at the start or when I modify the conveyor belt, otherwise the AddForce and AddTorque functions are used.

I took a look at your obstacle course scene. It's incredible, love it very much. I took one of the platforms and gave it the pole script that shifts it back and forth and the blob in the obstacle course moved with it just fine. In your script you directly set the velocity, so I thought maybe I should change my physics to use velocity. I switched it over and it still did not work. So I thought maybe it had something to do with how I've set up my softbodies/solver. To test I brought that same platform from the obstacle course into my scene, but the chips shifted with it just fine. I tried to change your code from setting velocity to using my forces, and the platform still worked fine with the chips softbody. I switch back to my conveyor as a sanity check and it still doesn't work. I can't seem to figure out what the issue is. My next guess is that it has to do with me creating the panels at runtime. I'll update again when I have more info.

(31-03-2022, 10:39 PM)Oxters Wrote: I took a look at your obstacle course scene. It's incredible, love it very much. I took one of the platforms and gave it the pole script that shifts it back and forth and the blob in the obstacle course moved with it just fine. In your script you directly set the velocity, so I thought maybe I should change my physics to use velocity. I switched it over and it still did not work. So I thought maybe it had something to do with how I've set up my softbodies/solver. To test I brought that same platform from the obstacle course into my scene, but the chips shifted with it just fine. I tried to change your code from setting velocity to using my forces, and the platform still worked fine with the chips softbody. I switch back to my conveyor as a sanity check and it still doesn't work. I can't seem to figure out what the issue is. My next guess is that it has to do with me creating the panels at runtime. I'll update again when I have more info.

Just got to test out the panel runtime creation theory and it seems I have found the culprit. If I use a prefab instead things work just fine. I cannot create panels from scratch. I'm so glad I found it, thanks for pushing me in the right direction.
Reply


Messages In This Thread
Friction on Moving Platform - by Oxters - 31-03-2022, 05:52 PM
RE: Friction on Moving Platform - by josemendez - 31-03-2022, 06:58 PM
RE: Friction on Moving Platform - by Oxters - 31-03-2022, 08:42 PM
RE: Friction on Moving Platform - by Oxters - 31-03-2022, 10:39 PM
RE: Friction on Moving Platform - by josemendez - 01-04-2022, 07:12 AM