Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / [SOLVED] Physics2D - jumping on a slope

Author
Message
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 28th Apr 2020 14:43 Edited at: 28th Apr 2020 14:46
Hi,
Please, watch the video below



In order to jump I apply an impulse force to the character as follows:


The issue remains even though I code as follows:


Although it works quite well on a horizontal ground, it does not work on slopes.
Any ideas?

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 28th Apr 2020 15:33 Edited at: 28th Apr 2020 15:38
i always stayed away from forces and impulses (while using SetSpritePhysicsVelocity() , instead) but you're using sprite offsets for x & y where the parameters should be world coordinates?

nevermind. i mis-read.

are you using forces/impulses for all movement?
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Apr 2020 15:38
This post has been marked by the post author as the answer.
Its hard to tell without seeing more code....To make a character jump upwards you would normally apply an impulse which is negative on the Y scale. A positive Y value impulse would make the character go downwards.

You may be applying a positive impulse so your character is rebounding off the floor making it seem like a jump when its actually a rebound... Try negating the Y value in the impulse?
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 28th Apr 2020 16:32 Edited at: 28th Apr 2020 16:34
@c0d3r9: I sent you a PM
Quote: "are you using forces/impulses for all movement?"

Yes
Quote: "Try negating the Y value in the impulse?"

You are right Bengismo. This is somehting that I didn't know. I am not experienced in 2D physics.
Thank you

Login to post a reply

Server time is: 2024-03-28 22:42:12
Your offset time is: 2024-03-28 22:42:12