Physics - touch controls vs. keyboard - odd behavior?
ColorplayGames
PRO Posts: 69
Hi all,
I'm working on an air hockey game and I'm seeing some odd physics behavior.
When I use touch controls to move the paddle and hit the puck, the puck moves a very short distance and stops.
When (using exactly the same physics settings for the actors) I move the paddle using keyboard controls, the puck goes flying.
Is this something anyone else has run into? Any thoughts on how to get the touch controls to play nicely with the physics? I'll continue playing with the physics settings to see if I can get the touch controls to work properly but I just find it odd that the two control schemes would produce such different results.
Thanks,
Jenna
I'm working on an air hockey game and I'm seeing some odd physics behavior.
When I use touch controls to move the paddle and hit the puck, the puck moves a very short distance and stops.
When (using exactly the same physics settings for the actors) I move the paddle using keyboard controls, the puck goes flying.
Is this something anyone else has run into? Any thoughts on how to get the touch controls to play nicely with the physics? I'll continue playing with the physics settings to see if I can get the touch controls to work properly but I just find it odd that the two control schemes would produce such different results.
Thanks,
Jenna
Comments
If your applying a drag to the puck you might want to tone it down a bit If not You might need to give it more speed ;D
Am I correct in assuming then that I won't be able to do this with pure physics? (ie the paddle hits the puck and gives it velocity?) I guess I need to cheat and add in some velocity when there's a collision?
What I was going to say was: Yes you will have to add in velocity because it cant be read, but there are actually a couple of things you might be able to do...
The idea that just came to me was... if you had an invisible object (the same size as your striker) and you constrained its position to the striker and then instead of when the striker collides with the puck, but when the invisible object collides (it would still be the same collision) since the invisible object is not being constrained by your finger, This might give it a real velocity! Not sure though, Also...
Im also in the process of making a hockey game (Maybe we should start a thread for all the people making hockey games to share logic etc) But someone a month back I believe told me that you could artificially create velocity by using the x and y axis' Unfortunately I cant find the thread I started and I never got it to work even when I had it Maybe If I went back now though (and found it) might be able to make it work!
every .01 seconds
Move To:
X: game.mouse.position.x
Y: game.mouse.position.y
Speed = 1000
This is the simple version (not taking into account all 5 touches, etc) but so far it's giving me the physics behavior I'm looking for with the puck!