Should I use gear joints to fix my issue?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MaxGamz
Party member
Posts: 100
Joined: Fri Oct 28, 2022 3:09 am

Should I use gear joints to fix my issue?

Post by MaxGamz »

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

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
(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?
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests