distance = Math.sqrt(xd*xd+yd*yd)
direction = -Math.atan2(xd,yd)/(Math.PI/180)
then you ask if the distance is less then the radius of the circle (if circle on circle collision use both radius's combined)
if the distance is less or equal (< then we go
the code above makes it so the particle cant pass through the circle, so it sets its position relitive to its direction
then you have to set new velocities to the particles
(i useually have to stuff around for a while to get what i want because i dont learn physics at school yet :[ )
for this i made the particles y velocity just bounce
This very very cool...If I knew how to use this code *I saw your formula and I don't know...pretty advanced stuff for me personally* but if I could do it...i would use this effect to have the cursor as a movie clip of Pegasus and turn the blocks into droppings and have the circles as frowning heads...I apologize for that visual but my small mind thinks like that again nice coding on that ...works perfectly
Daily Literature Deviations is a group that is dedicated to bringing literature to the forefront of the deviantArt community. We attempt to accomplish this by daily featuring Literature artists from around the community that deserve the recognition, but are not getting it.
Each day we will feature 10 deviations from the Literature categories in a News Article. In order to support the artists that we feature, we ask that you the news article as well as check out the individual pieces. We understand that each day you may not be able to check out each and every one of the pieces, everyone has their own things going on. We just ask that you make an attempt to help support the growing Literature community.
When it comes to community spirit, `Rushy is a shining example. From participating in devmeets, to providing positive encouragement to other artists, `Rushy can always be found demonstrating what it really takes to be a true deviant. It's without any hesitation that we are delighted to award the Deviousness Award for July 2009 to `RushyRead More
Devious Comments
Comments
xd = particle._x - circle._x
yd = particle._y - circle._y
after that you can get the distance and direction
distance = Math.sqrt(xd*xd+yd*yd)
direction = -Math.atan2(xd,yd)/(Math.PI/180)
then you ask if the distance is less then the radius of the circle (if circle on circle collision use both radius's combined)
if the distance is less or equal (<
particle._x = circle._x+(Math.cos((direction+90)*(Math.PI/180))*radius
particle._y = circle._y+(Math.sin((direction+90)*(Math.PI/180))*radius
the code above makes it so the particle cant pass through the circle, so it sets its position relitive to its direction
then you have to set new velocities to the particles
(i useually have to stuff around for a while to get what i want because i dont learn physics at school yet :[ )
for this i made the particles y velocity just bounce
yv = -yv*0.5+2 // y velocity = -y velocity * bounce + weight
and i tryed to make some of the y vecocity transfer into x velocity
xv = (Math.cos(dir+90)*yv)*0.5
if you need more help just ask, i know alot of formulas
thanks
good work.
--
Stalk me
[This is the Panic Office, section nine-seventeen may have been hit. Activate the following procedure.]
--
Midlife Crisis On Infinite Earths
--
Midlife Crisis On Infinite Earths
Previous Page1234Next Page