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 .
Z_ReC
Prole
Posts: 7 Joined: Sat Nov 14, 2015 2:48 am
Post
by Z_ReC » Mon Nov 16, 2015 7:17 am
First:
Thanks to all who helped!
Second:
S0lll0s wrote: Doctory wrote: switch from the love.physics, it is impossible to get a constant velocity in love.physics without screwing something up
Not really, he just needs to do a few things every frame:
get current velocity vector (:getLinearVelocity())
normalize and scale it by the target velocity
Now you can either just set it directly (setLinearVelocity()), which might look weird, or instead apply a force:
subtract the actual velocity from the target velocity vector
apply a force proportional to that difference
Try to duplicate your example, but I could not, you could guide me more? Sorry!
s-ol
Party member
Posts: 1077 Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:
Post
by s-ol » Tue Nov 17, 2015 2:31 pm
If you don't want to mess with the velocity itself you basically read the current velocity, and if it's too slow, apply a force to the right, if its too fast, apply a force to the left to slow it down.
Users browsing this forum: Ahrefs [Bot] , Bing [Bot] and 3 guests