Home › Forums › Bug Reports and Feature Requests › Physics Not Working Correctly?
Tagged: physics
- This topic has 11 replies, 4 voices, and was last updated 5 years, 5 months ago by Crunch.
-
AuthorPosts
-
2019-05-06 at 10:35 pm #14471patrickbeltCustomer
Hello,
A few months ago the physics engine was introduced to Verge3D, and Yuri showed me how to set up the drag and drop features using puzzles. At the time I was able to copy the example and make the physics work as desired. I’m now using the latest version of Verge3D: v2.12 (as well as the latest version of Blender 2.8), and am trying to use the drag and drop physics again… but now it’s not working correctly.
In the simple example I’ve attached, if I use the “create physics body” puzzle it allows me to drag the cubes, but as soon as I let go, the cubes snap back to their original locations instead of falling straight down as intended. (Please see the attached image for the puzzle setup I’m using.)
I tested this same puzzle logic is Verge3D v2.11-pre2 and it works as intended.
In the actual project I’m working on, which is much larger, creating and adding any physics bodies to the puzzle logic also stops the following features from working completely: all camera tweens, all drag and drop abilities, and all hover-over functions that change the cursor to a hand or enable highlights.
I don’t need to have physics enabled for my project, but it would be a nice addition. Please let me know if this physics issue is a glitch, or if I’m simply tired and doing something wrong :) Thanks! -Patrick
Attachments:
You must be logged in to view attached files.patrick.c.belt@gmail.com
2019-05-08 at 8:02 am #14524Yuri KovelenovStaff2019-05-08 at 8:27 am #14527Alexander KovelenovStaffHi,
I did check, the logic you provided should work as expected. It might be an issue with updating your project. Did you follow the procedure described in the User Manual?
2019-05-08 at 11:41 pm #14558patrickbeltCustomerAlexander, in regards to my actual project, yes – I followed the updating steps as usual, and I usually don’t have an issue. The only thing I haven’t tried yet is rebuilding all the puzzles from scratch. However, before I go to that extreme, I created a new simple project to test the physics first. After doing so, I still have issues with using physics in v2.12; the two cubes snapping back into place instead of falling after dragging. Although it doesn’t illustrate some of the other issues I have related to adding physics puzzles to my main project, I believe it does show that something isn’t working correctly in regards to physics.
Attached is the zipped file for the simple test project that demonstrates the physics issue I described in my original post above. Thanks – Patrick
patrick.c.belt@gmail.com
2019-06-03 at 6:46 pm #15303patrickbeltCustomerHello,
I never saw an update to the physics issue I was having. I’m now using Verge3D v2.12.5 for Blender 2.8 and am still having the same issue. I’ve zipped and attached a basic example project, and an image of the puzzle logic that it uses. In this simple example I have two blocks that stack using physics. I want to be able to click and drag either block, and then the block should drop to the plane and stay where I drop it. Instead, when I stop dragging a block, it snaps back to its original location (just like my previous example in this thread). Any help is appreciated. Thank you – Patrick
patrick.c.belt@gmail.com
2019-06-03 at 8:00 pm #15309CrunchCustomerIf you turn off the physics effect on the drag start than back on in the drag drop I think you will get the effect you were looking for.
Also, you are going to want to head back to blender, select your plane, than click object>apply scale. Otherwise, the cubes will fall right through the floor.
2019-06-04 at 2:47 am #15312patrickbeltCustomerThank you. The puzzle example you shared did the trick. The only issue I have now is that when dragging a cube it doesn’t interact with the other cube and push it out of the way. I suppose that’s because the physics object is turned off while dragging… Do you think it’s possible to achieve this kind of object interaction while dragging, in addition to the falling object fix you suggested earlier?
patrick.c.belt@gmail.com
2019-06-04 at 4:00 pm #15361CrunchCustomerStart with the cube as a dynamic object.
On drag start, remove the dynamic physics and assign it as an kinematic object
On drag drop, remove the kinematic and assign it back to a dynamic object.2019-06-04 at 4:14 pm #15363CrunchCustomerAdded a physics parameter puzzle so when the cube collides it will slide
2019-06-04 at 4:53 pm #15365CrunchCustomerAdded some hacky code which will fling the cube (applying linear velocity) a bit on the x-axis after releasing the drag – provided the object was dragged more than 1 unit across the x-axis.
So many more experiments I would like to try but so little time ☹
2019-06-04 at 5:52 pm #15370patrickbeltCustomerWow, wow! Look at you go! Thank you so much for all of this. I’m very impressed, and appreciate the timely responses. (Although I couldn’t get the “hacky code” example to work.)
It sounds like you’re busy, but I have one more for you if you’re interested: If I drag the red cude (bottom cube) first, the top cube doesn’t move at all. The top cube should move with the bottom cube due to friction. (I really wanted to see if I could figure this one out on my own, but after a couple hours of tinkering I have decided to reach out to you again since you seem to really know your code/puzzles.)
patrick.c.belt@gmail.com
2019-06-05 at 2:50 am #15377CrunchCustomerOh I am always up for a challenge. I haven’t spent much time with physics in Verge (even though its so much fun!) but after a couple of experiments today, I got this one working.
Staying along the lines of the other example I showed you, I initially tried to see if I could quickly cycle (using a loop with a clock) between a kinematic object (which can be grabbed in drag event) and dynamic object during the “move” event of the dragged over puzzle, and see if that added any stickiness/friction between the cubes. That failed.
To have interactions (physical interactions) between two dynamic objects, I don’t think you can ‘touch’/interfere with them. So, what I ended up doing, was to tie a conventional (no physics applied) cube (with a drag move event) to apply force on the blue cube corresponding to how far, and in what direction the conventional cube was dragged.
See the attached puzzle. The conventional cube (cube.002, or the “ghost cube) is slightly bigger than the blue cube (cube) and it’s position is set by a ‘every frame’ puzzle to match the blue cube. It also has a transparent material so you can’t see it. Click on the button in the upper left corner toggle between a transparent and translucent material on the ghost cube to see what is going on.
-
AuthorPosts
- You must be logged in to reply to this topic.