[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

## How to make linearDamping / friction work with setGravity( 0, 0 ) Started by mail6860 May 07 2018 07:14 AM

4 replies to this topic
lineardumping gravity friction
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

### mail6860

[GLOBAL: userInfoPane.html]
mail6860
• Observer

• 6 posts
• Corona SDK

I'm quite new to Corona and I try to develop a icehockey-like game (view from top). Thus, I don't need gravity. If I want to push the puck - wo can I simulate the friction of the ice in this mode?

I use linearDamping but the puck won't reduce it's speed over time. What am I doing wrong?

```local physics = require "physics"
physics.start()
physics.setGravity( 0, 0 )

local backGroup = display.newGroup();
local stoneGroup = display.newGroup();

local ground = display.newImageRect(backGroup, "assets/images/background-ice.png", 723, 1400 )
ground.x = display.contentCenterX
ground.y = display.contentCenterY

local activeStone = display.newImageRect( stoneGroup, "assets/images/puck.png", 150, 150 )
activeStone.x = display.contentCenterX
activeStone.y = display.contentHeight
activeStone.linearDamping = 100

physics.addBody( activeStone, "dynamic", { radius = 150, bounce = 0 }     )

local function pushPuck ()
activeStone:applyForce( 0, - 100, activeStone.x, activeStone.y)
end

```

[TOPIC: post.html]
#2

### roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
• Corona Geek

• 7,666 posts
• Corona SDK

This is a violation of Forums guidelines.

[TOPIC: post.html]
#3

### mail6860

[GLOBAL: userInfoPane.html]
mail6860
• Observer

• 6 posts
• Corona SDK

Sorry, I couldnt see my question after I did submit it so I thought I have to ask it again.

[TOPIC: post.html]
#4

### roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
• Corona Geek

• 7,666 posts
• Corona SDK

Cool. No prob.

[TOPIC: post.html]
#5

### Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
• Moderator

• 26,675 posts
• Enterprise

My bad. I should have deleted the duplicate post when I was approving them.

Rob

[topic_controls]

[/topic_controls]