Game Development Community

Constant forces while colliding

by Joshua Hogsett · in Torque Game Builder · 09/25/2011 (4:27 pm) · 4 replies

I'm having some issues with setting a constant force on an object while it's colliding with another object. This includes colliding with triggers.

I'm using constant forces to move my character around the screen, and when he collides with a wall, it clamps as it should, but if I try to apply the constant for diagonally towards the wall, he stays stuck in the same place instead of moving along the surface of the wall.

In another situation, when the object enters a trigger, it seems like the force won't work whatsoever and the object gets stuck inside of the trigger.

I've played with a bunch of different values, like friction (set em all to 0), and I'm still getting this effect. Is there something I'm missing or any potential solutions to this?

Thanks!

EDIT* I just did some testing and it is able to set the constant force, but it's having no effect
I'm pretty sure this is a bug with friction and the physics engine

#1
09/25/2011 (5:48 pm)
a run around for the wall scenario is to set off the clamp, if that is the reason for the freeze, (sometimes, you can play with the settings of the wall and the object to get preferred results..however...) the run around could be....

function uponCollisionBetweenWallAndObjectZ()
{
%objectZ.setAtRest();
%objectZ.disableAllControls();
%this.schedule(xTIme, regainControls)
}

Something like that would temporally disable the objects ability to move, then after schedule it could move however you want. Tho, it would not, as is, allow skidding. That would have to be figured out.



Keeping CLAMP on, and playing with settings, friction, like you said, mass etc, might get you something.

Good Luck!

#2
09/25/2011 (6:07 pm)
does friction even work in this engine? I've played with friction numbers in a series of situations and never seen any difference. Has someone been able to successfully use and change the values of friction?
#3
09/25/2011 (8:00 pm)
I built a game a while back which uses friction on objects. just did a test setting the friction to 0.1 and 9.0. There was seemingly no difference. However, in my game, the object, simply bounces off other objects. It is not like it is a car, driving along different types of surfaces.


Having said that, the day TGB/iTGB installs Box2D, will be a happy day. I am willing to chip in financially even to see it happen. Anyhow, thats just me.


#4
09/25/2011 (10:58 pm)
Haha yea I'd totally be stoked on that... I'm considering putting a hault on this project and work on implementing box2d in my engine so that everything might work as intended... I'm considering reporting the friction as a bug.