I am making a game with spriteKit that involves applying very large impulses to certain nodes.
However throughout testing I have seen that some numbers seem to be too big. This lead me to dig around and I found that when I apply a very strong impulse, it will move the sprite forward at the correct velocity for one frame, before brining it down to a much smaller number. For example I would apply an impulse of one million and by the second frame the velocity is 300,000
For these tests I have turned off linear and angular dampening, made the SpriteNode indifferent to gravity and gave it a mass of zero. The line of code used to run the impulse is: ball.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 100000000)) where "ball" is an SKSpriteNode, and 100000000 is an arbitrary large number. Running this and printing the velocity.dy per frame, I see the first frame is 100000000.0, as expected, but the following frames the velocity changes and stays at 35999.99609375, a seemingly random number.
I am wondering how I can fix this, are there any hidden maximums to velocity I must change, or any further dampening settings I must change? All help is greatly appreciated! :)
However throughout testing I have seen that some numbers seem to be too big. This lead me to dig around and I found that when I apply a very strong impulse, it will move the sprite forward at the correct velocity for one frame, before brining it down to a much smaller number. For example I would apply an impulse of one million and by the second frame the velocity is 300,000
For these tests I have turned off linear and angular dampening, made the SpriteNode indifferent to gravity and gave it a mass of zero. The line of code used to run the impulse is: ball.physicsBody?.applyImpulse(CGVector(dx: 0, dy: 100000000)) where "ball" is an SKSpriteNode, and 100000000 is an arbitrary large number. Running this and printing the velocity.dy per frame, I see the first frame is 100000000.0, as expected, but the following frames the velocity changes and stays at 35999.99609375, a seemingly random number.
I am wondering how I can fix this, are there any hidden maximums to velocity I must change, or any further dampening settings I must change? All help is greatly appreciated! :)
So that may well be a design limit on speed (not on impulse as this test shows).
That's large enough speed for any man made object (the fastest was New Horizon en route to Pluto at 21 000 m / s).
But if you are simulating for astronomy, that may be a bit limited.
You should ask the question to Apple Support if no Apple DTS is answering to this post.
That's large enough speed for any man made object (the fastest was New Horizon en route to Pluto at 21 000 m / s).
But if you are simulating for astronomy, that may be a bit limited.
You should ask the question to Apple Support if no Apple DTS is answering to this post.