Physics problems.

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.
User avatar
nfey
Citizen
Posts: 63
Joined: Tue Feb 18, 2014 9:50 am
Location: Romania

Re: Physics problems.

Post by nfey »

tio wrote:
nfey wrote:From what i can see, you are using player.x/playr.y to draw and move the caracter. You should be using player.body.x/y instead, because the way you are doing it now, your "player" object has the updated position after running/jumping, but the body object does not.
If he wants to use physics, it's not that "healthy" to move a body using absolute positions. Apply forces is better and don't break physics simulation calcs ;)
Do you have an example of using forces for linear movement?
I'm working on a small project which uses love.physics for collision detection between actors and pixel collision for mouse clicks; I intend to also use force application for certain special powers/spells; but for the actors' movement, I'm currently using the method I suggested above, and it seems to be working pretty well (I'm not even doing anything on the physics callbacks atm, I guess I could use those to polish the collisions a bit).
User avatar
tio
Citizen
Posts: 61
Joined: Thu Dec 12, 2013 1:04 pm
Location: BR BR?
Contact:

Re: Physics problems.

Post by tio »

nfey wrote: (...)

Do you have an example of using forces for linear movement?
I'm working on a small project which uses love.physics for collision detection between actors and pixel collision for mouse clicks; I intend to also use force application for certain special powers/spells; but for the actors' movement, I'm currently using the method I suggested above, and it seems to be working pretty well (I'm not even doing anything on the physics callbacks atm, I guess I could use those to polish the collisions a bit).
You can move the way you did (it's actually better using your way), but you need to do the collisions by hand. Mix this method with love.physics will only make things unnecessarily complex (and hard) to make it work good. If you want to use love.physics, ok, do everything using built-in physics. If you want to use your char movement approach, ok, do everything by hand (including movement restriction and collision detection).
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 2 guests