Top-down liquid (water) physics simulation

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
dusoft
Party member
Posts: 711
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Top-down liquid (water) physics simulation

Post by dusoft »

Some basic pointers (where fixture is fixture of player's body):

Code: Select all

player.state.x, player.state.y = fixture:getBody():getPosition() -- X,Y in world
    player.state.heading = math.round(math.deg(fixture:getBody():getAngle())) -- heading angle, beware it can be multiplies of 0-360 and even negative
    local speed_x, speed_y = fixture:getBody():getLinearVelocity() -- linear velocity on two axes
    player.state.speed = math.sqrt(speed_x ^ 2 + speed_y ^ 2) -- merged vehicle speed, e.g. for speedometer
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest