swift


SKNode to stop at exact position after applyImpulse


The ball.physicsBody is set as below to allow it to bounce infinitely inside SKPhysicsBody(edgeLoopFrom: frame).
ball.physicsBody?.friction = 0
ball.physicsBody?.restitution = 1
ball.physicsBody?.linearDamping = 0
ball.physicsBody?.angularDamping = 0
To make it bounce, I use applyImpulse.
ball.physicsBody?.applyImpulse(vector)
I want to the ball to land on a platform (as shown in the screenshot) without bouncing back.
I have tried to set its restitution = 0 and velocity = .zero when it contacts with the platform inside didBegin(_:). But it always bounces back if the velocity is high. It touches the bottom frame if it is not set to collide with the platform.
I wonder if anyone can provide a code snippet to achieve this. Thanks.

Related Links

How do you make a transparent view that changes color [closed]
swift uploadTaskWithRequest with didReceiveData
stringByReplacingOccurrencesOfString removes whole string
Why can I use a constant initialization as if-condition? [duplicate]
How to convert Optional String to String
Unwrap an Optional Within a Multiple Parameter Function
Swift on Ubuntu - No such file or directory
Swift: programmatically enumerate outgoing segues from a UIVIewController
Can't get plist URL in Swift
Getting data from Parse in condition
How to assign an image from URL to NSData by swift?
Swift append String var to an List by reference
SearchBar & Display in table view with Coredata using Swift?
How to delay the start of a function
Swift Shrink Animation
What is causing “Use of unresolved identifier ParseClientConfiguration”?

Categories

HOME
sas
numpy
project-management
angular-cli
wsdl
windows-7
facebook-graph-api
jbehave
apache2
rfc
algorithmic-trading
data-science-experience
onenote-api
dropbear
x11
sign
pdo
jquery-terminal
phpbb
vs2017
google-ima
apple-tv
rworldmap
bcrypt
data-cleansing
codelite
ab-initio
fileinfo
dd-wrt
ioc-container
graph-databases
edb
hotmail
rhomobile
honeysql
liquid-xml
es-shell
parse-android-sdk
twiki
nsexception
jrules
html-agility-pack
crop
fastq
asmx
number-theory
pagefile
iron.io
efxclipse
barcode-printing
objloader
settimeout
coremidi
ebtables
firepath
metalsmith
dojox.charting
faraday
remoteapp
date-format
picking
group-concat
interactive-brokers
servlet-3.0
test-class
throughput
java.util.calendar
hornetq
zuora
matcaffe
android-snackbar
ipojo
mptcp
wif
adodb
google-earth-plugin
cpu-speed
and-operator
zipalign
baucis
driver-signing
dynamic-binding
nuspec
google-closure-library
mailcore
fortran77
xslkey
vertical-scrolling
domain-calculus
attachevent
pstree
gjs
objective-c-protocol
hashalgorithm
text-size
electronic-signature
noir
loadui
drawtext
svn-hooks
osx-leopard
openvg
visual-studio-dbpro

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App