Should I use gear joints to fix my issue?
Posted: Tue Nov 01, 2022 11:39 pm
I'm planning on making a ball game but one of the issues is that if the player hits the ball, the animations start glitching.
Here is an example
(when self.grounded returns true, it plays the idle and running animations)
After the player hits the ball, it plays the sky animations and it's unable to jump. I had an Idea of placing a collidable line on top of the ball and set it's type to "Ballz". However I came across a new issue. I don't want the line to collide with the ball but I also don't want the line to move from it's original position. I tried to implement Revolute Joints and Distance Joints but neither gave me the desired effect. Would gear joints be a better option?
Here is an example
Code: Select all
function Player:update(dt)
self.xVel, self.yVel = self.collider:getLinearVelocity()
currentAnim:update(dt)
if self.collider:enter('Border') or self.collider:enter('Ballz') then
self.grounded = true
elseif self.collider:exit('Border') or self.collider:exit('Ballz') then
self.grounded = false
end
self:move(dt)
self:skyAnim()
end
After the player hits the ball, it plays the sky animations and it's unable to jump. I had an Idea of placing a collidable line on top of the ball and set it's type to "Ballz". However I came across a new issue. I don't want the line to collide with the ball but I also don't want the line to move from it's original position. I tried to implement Revolute Joints and Distance Joints but neither gave me the desired effect. Would gear joints be a better option?