So in my game i have an object that jumps, i have tried both applyLinearForce and applyForce and both do what i like, but every once and a while when i jump it randomly makes my object jump about 4 times as high as it should. is this a known issue with corona and the physics? i need to have a steady jump [import]uid: 19620 topic_id: 6684 reply_id: 306684[/import]
I don’t think you really want to use applyForce for this purpose. A jump is a sudden impulse, not a continuous force.
Also, what is applyLinearForce? [import]uid: 12108 topic_id: 6684 reply_id: 23682[/import]
Oh haha i ment to say applyLinearImpluse, in the description for this API it says its a sudden jolt, so it does work good for the jump of my object but it does the same thing. maybe ill take a video and post it up. [import]uid: 19620 topic_id: 6684 reply_id: 23685[/import]
Ok so check this video out, the first two jumps are NOT how high its set to jump, it just so happens that i got it to do it twice as i started recording, you can see after what the normal jump is like here is the link:
http://www.youtube.com/watch?v=aPoCuO7uPmk
Also i changed back to using applyLinearImpulse [import]uid: 19620 topic_id: 6684 reply_id: 23690[/import]
can you put some code. i actually don’t know what am suppose to look at on the video.
c. [import]uid: 24 topic_id: 6684 reply_id: 23783[/import]
sure, so here is my functions to move my circle object forward and to make it jump:
nction moveForward(event)
if total\_collisions \>= 1 then
local v = tireObject.angularVelocity
tireObject.angularVelocity = v + 350
end
end
--
function jump(event)
if total\_collisions \>= 1 then
tireObject:applyLinearImpulse(0, -0.09, tireObject.x, tireObject.y)
end
end
--
Then this is my function to check for collision, this only allows the player to move or jump the object when its collided with the ground:
function onLocalCollision( self, event )
if ( event.phase == "began" ) then
total\_collisions = total\_collisions + 1
elseif ( event.phase == "ended" ) then
total\_collisions = total\_collisions - 1
end
end
--TOUCH DOWN LISTENER
tireObject.collision = onLocalCollision
tireObject:addEventListener( "collision", tireObject )
So obviously this isnt all my code, but maybe this is enough to give you a better idea of what im doing.
Anyways as i was saying before, i am just trying to get a consistent jump, but randomly sometime the force applied to the jump seems to be 4 times what it should be (just guessing)
What other info can i give you? refer to the video again and you will see the first two jumps are the ones that are jumping too high, the rest are the normal jumps…
[import]uid: 19620 topic_id: 6684 reply_id: 23825[/import]