Forum

Enabling and Disabling Physics Simulation

12 June 2017 01:43
Thanks so much for your support and thanks for appreciating the project, it took me around 15 minutes to be made. I took the node out of the loop as you suggested but unfortunately the problem still remains. However what do you tell me about the angular velocity? as you guessed the m_physics.apply_velocity(inParams[0],0,20,0) applies only a linear velocity to the ball local Y, in other words the ball should not rotate on itself at all after throwing, whereas it does (except the first throw however) .. do you have the same issue or it is only me?
12 June 2017 03:35
Ya, the ball rotates. It seems to be sort of a random value introduced by the physics engine. Sometimes fast, sometimes slower. I will attach a video. The ball shoots and resets very reliably for me. (I added some blocks).
12 June 2017 12:19
I saw your video and the ball behaves very reliably as you said, and with the blocks you added it really looks like angry birds ;)
As for the angular velocity.. dont know if you noticed but the rotation of the ball when you throw is the same as it was before the reset, in fact if you always reset the ball before it touches anything (as I did in my video) then the ball will never rotate on itself, give it a try and let me know if I'm right
12 June 2017 17:11
Okay, I finally know what you mean LOL. The ball retains its spin. Sorry it took me so long to figure out what you want. I tried the apply_torque function but it did not change the behavior.
m_physics.apply_torque(inParams[0], 0, 0, 0);

Maybe the answer is to load a new instance of the ball each time you shoot. That also means you can shoot more balls while the first one is still in the air. Maybe later today I will see if that works.
12 June 2017 18:18
Finally! dont know .. maybe my english is worse than I thought however I tried a lot before posting my problem here, including the m_physics.apply_torque(inParams[0], 0, 0, 0); which doesnt work because it resets only the currently active angular forces (torques) applied to the object by using the same function. The only working solution I found is, as you guessed, to create a new instance of the object every time we throw, it works but is a bad workaround I think, cause we waste time creating an identical new object (in case of complex meshes we could have a little fps drop every time we do it) while we already have one, that's the reason why I wrote in the forum, cause I wonder if there is a nice solution to this problem, like a way to tell the physics engine to reset all the forces and velocities it retains on the ball
12 June 2017 20:01
Actually, your English was correct. Angular Velocity means spinning speed but I was reading as direction of travel.
Anyway, we may have a bug, I will post our results in the bug report section.
12 June 2017 20:36
all right and thanks a lot for the support
 
Please register or log in to leave a reply.