Game Development Community

Some physics issues and game work in progress

by Dylan Taft · in Torque Game Builder · 10/23/2012 (6:08 pm) · 5 replies

So, here's what I got so far.
https://www.youtube.com/watch?v=e1n2iCDN0wM&feature=plcp

Someone said my physics are really off, that jumps should be more parabolic and floaty, and the gravity gun should be more like a trebuchet.


I made some changes and came up with
https://www.youtube.com/watch?v=FttSgFGJSIw&feature=plcp

But..

So I _was_ using clamp physics, and damping for fake friction(since TGE doesn't seem to support reducing velocity based on friction over time?)

But, using damping messes with gravitic and constant forces. It was making them fall off very quickly, so the jumps would end abruptly.

So, in the new video, in the player's update function, I do %this.setLinearVelocityX(%this.getLinearVelocityX() * .80); I can add some logic in there to only do it when the player is on the ground.

Is this the "right" way to do it? It seems hack-y.

#1
10/24/2012 (5:35 pm)
I don't know about using the damping and friction. Constant force works pretty good on it's own. What exactly does the damping and friction do?
#2
10/24/2012 (8:44 pm)
Damping reduces velocity over time. I think damping of 1 reduces velocity by half per second.

Friction has something to do with rigid body collisions.


I don't want a player to just "stop" when they let go of the button, I want them to slide a bit. Do most people do that in code with Torque, instead of relying on physics?
#3
10/24/2012 (11:15 pm)
Hmmm... the documentation says this "Damping is a percentage value of the amount of linear and angular velocity the object loses per second. A damping value of 1.0 will cause the object to be completely still after 1 second. "

What I would try is when the character starts moving you first turn off damping then for the first bit of acceleration you set the speed to an ever increasing value (in very small increments) every frame that peaks after a second or so.
Then when the character should stop you turn on damping. Don't forget to turn it off when jumping and back on when you touch the ground.

I'm not sure friction is quite the answer here.

I hope that makes sense and it helps somewhat. :)
#4
11/13/2012 (9:31 am)
Thanks, that works well!
#5
11/21/2012 (1:24 pm)
Dude that game looks sick.

You should totally post WIP and problems as separate things. The TGB forums aren't the best for feedback, but you will still get a better response if you functionally decompose your posts more.

I'm so excited about all the platformers people are working on with TGB. Keep me posted!