Hi, i don’t find the correct setting to move my character faster but on a short distance. Always the inerty is too big and my character move on a long distance…I play with gravity scale, friction and density but without success. Have you something for me? Thanks.
Hi @espace3d,
There are too many potential factors for me to help you, given this limited information. What object are you moving? How are you moving it, by application of force, or by strict linear velocity? What other properties have you set on the object? Does it have linear damping? I’ll need several more details before I can help…
Thanks,
Brent
hi Brent,
i have forgotten some things.I want that my character move faster at the begin and slow at the end. it’s for a nervous game with no gravity.
i play with linear impulse…and damping but i don’t see the difference with the damping
hope i be clear …
Thanks
local physics = require("physics") physics.start() physics.setScale(6) physics.setGravity(0,0) local playerdensity=.7 local playerEnemyFriction=.3 local playerEnemyBounce=.06 local function drawPLayer() local sheetData = { width=15, height=14, numFrames=7, sheetContentWidth=105, sheetContentHeight=14 } local mySheet = graphics.newImageSheet( "sprite2.png", sheetData ) local sequenceData = { { name = "runNormal", start=1, count=6, time=12500 }, { name = "runLeft", frames={ 1,4,4,4,4,4,7,2,2,2 }, time=18000 }, { name = "runRight", frames={ 1,4,4,4,4,7,4,5,5,5 }, time=18000 }, { name = "runFast", frames={ 1,2,2,2,5,7,5,6,5,1,2,4,5,6,2,5,1 }, time=6000 } } local players=display.newGroup() players.body = display.newSprite( players, mySheet, sequenceData ) players.body:setSequence( "runFast" ) players.body:play() player=players player:translate(240, 230) player.myid=2 physics.addBody( player, { density=playerdensity, friction=playerEnemyFriction, bounce=playerEnemyBounce,shape=pentagonShape, filter=playerCollisionFilter } ) player.isFixedRotation = true player.lineardamping = 11 return player end ... local function joystickTouched(event) if event.phase == "began" then display.getCurrentStage():setFocus(character) elseif event.phase == "ended" then player:applyLinearImpulse((event.x - event.xStart ), (event.y-event.yStart),player.x,player.y) display.getCurrentStage():setFocus(nil) end end ....
Hi again,
You didn’t type in the property correctly. It’s case-sensitive. You have this:
[lua]
player.lineardamping
[/lua]
But it should be this:
[lua]
player.linearDamping
[/lua]
Hi @espace3d,
There are too many potential factors for me to help you, given this limited information. What object are you moving? How are you moving it, by application of force, or by strict linear velocity? What other properties have you set on the object? Does it have linear damping? I’ll need several more details before I can help…
Thanks,
Brent
hi Brent,
i have forgotten some things.I want that my character move faster at the begin and slow at the end. it’s for a nervous game with no gravity.
i play with linear impulse…and damping but i don’t see the difference with the damping
hope i be clear …
Thanks
local physics = require("physics") physics.start() physics.setScale(6) physics.setGravity(0,0) local playerdensity=.7 local playerEnemyFriction=.3 local playerEnemyBounce=.06 local function drawPLayer() local sheetData = { width=15, height=14, numFrames=7, sheetContentWidth=105, sheetContentHeight=14 } local mySheet = graphics.newImageSheet( "sprite2.png", sheetData ) local sequenceData = { { name = "runNormal", start=1, count=6, time=12500 }, { name = "runLeft", frames={ 1,4,4,4,4,4,7,2,2,2 }, time=18000 }, { name = "runRight", frames={ 1,4,4,4,4,7,4,5,5,5 }, time=18000 }, { name = "runFast", frames={ 1,2,2,2,5,7,5,6,5,1,2,4,5,6,2,5,1 }, time=6000 } } local players=display.newGroup() players.body = display.newSprite( players, mySheet, sequenceData ) players.body:setSequence( "runFast" ) players.body:play() player=players player:translate(240, 230) player.myid=2 physics.addBody( player, { density=playerdensity, friction=playerEnemyFriction, bounce=playerEnemyBounce,shape=pentagonShape, filter=playerCollisionFilter } ) player.isFixedRotation = true player.lineardamping = 11 return player end ... local function joystickTouched(event) if event.phase == "began" then display.getCurrentStage():setFocus(character) elseif event.phase == "ended" then player:applyLinearImpulse((event.x - event.xStart ), (event.y-event.yStart),player.x,player.y) display.getCurrentStage():setFocus(nil) end end ....
Hi again,
You didn’t type in the property correctly. It’s case-sensitive. You have this:
[lua]
player.lineardamping
[/lua]
But it should be this:
[lua]
player.linearDamping
[/lua]