Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Trying to achieve a torque affect but running into some issues.
Started by kieron.mcdougall8473 Apr 22 2019 10:19 AM

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

kieron.mcdougall8473

[GLOBAL: userInfoPane.html]
kieron.mcdougall8473
  • Observer

  • 1 posts
  • Corona SDK

Hey all,

 

I'm pretty new to Corona and Lua as a language but I'm trying to make a start on my own game. However, I am running into an issue that I'm hoping one of you may have a solution to.

 

In my game, I have a ball that collides with a static object which is a paddle. I want the ball to rotate after it collides with the paddle and this works to an extent. I have set my balls bounce to 1 and set the paddle to 0 and I know that this keeps it bouncing to the same height each time. The problem really comes when I apply torque to the ball. When the ball hits the paddle I want the ball to bounce back up (as it does) and I also want it to rotate the image. However, I am finding with using the object:applyTorque my ball does spin as intended however each time it collides with my paddle it jumps higher and higher each time.

 

If anyone has any ideas of a way to stop this from happening, or if I should be using a different function please let me know. 

 

Thanks for taking the time to read this :)

 

 



[TOPIC: post.html]
#2

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 484 posts
  • Corona SDK

My guess would be the that force from the torque is "spilling over" into the collision or creating an immediate secondary collision.

 

Suggestions:

1. add angular damping to the ball

2. try playing around with angular impulse instead of torque - it might feel more natural

3. apply the torque or angular impulse with a delay so the rotation is applied after the bounce has started 




[topic_controls]
[/topic_controls]