physics help needed , bouncing ball

  • (2 Pages)
  • +
  • 1
  • 2

21 Replies - 1350 Views - Last Post: 07 September 2013 - 04:59 PM

#16 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3572
  • View blog
  • Posts: 10,414
  • Joined: 08-June 10

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 03:21 PM

I donít know what language that is, but itís not Javascript.
Was This Post Helpful? 0
  • +
  • -

#17 bboyzeez  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 143
  • Joined: 16-December 12

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 03:37 PM

since that code above what i have done is , everytime if hits floor or reaches its new height(comingup) i reset time and it seems to go i suppose smoother and technically does get faster on them last few bounces before it comes to a stop

here is a link to video of the ball bouncing so you can see what is happening now

http://www.youtube.c...h?v=2CA4ZGNY0G0
Was This Post Helpful? 0
  • +
  • -

#18 andrewsw  Icon User is offline

  • It's just been revoked!
  • member icon

Reputation: 3738
  • View blog
  • Posts: 13,067
  • Joined: 12-December 12

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 03:47 PM

View PostDormilich, on 07 September 2013 - 10:21 PM, said:

I don’t know what language that is, but it’s not Javascript.

I believe it is Unity (aka UnityScript). I know nothing about Unity - Mathf gave me the clue.

This post has been edited by andrewsw: 07 September 2013 - 03:49 PM

Was This Post Helpful? 0
  • +
  • -

#19 bboyzeez  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 143
  • Joined: 16-December 12

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 04:09 PM

oh sorry ye its unity (javascript)


ok looking at this now ... the ball starts coming up but as it reaches its next height it still have upward velocity hence it looks like its being pushed back down....

so i was saying that when the ball hits the ground or hits its highest point then the time resets to 0 and that error above is happening so when i just say that the time only resets once the ball starts to fall i find that the ball doesnt reach its highest point and only goes up half of what its supposed to using the equation below

velocity -= acceleration * Mathf.Pow(Time.time/60,2);

any ideas where im going wrong?

logic would say..i know the distance it has to travel , i know the starting speed so somehow with them degrade the speed until it becomes 0 as it reaches highest point?

This post has been edited by bboyzeez: 07 September 2013 - 04:11 PM

Was This Post Helpful? 0
  • +
  • -

#20 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3572
  • View blog
  • Posts: 10,414
  • Joined: 08-June 10

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 04:45 PM

Quote

here is a link to video of the ball bouncing so you can see what is happening now

yupp, looks like you use wrong functions.
- line #10, v = g·t² ??? (m/s ≠ m/s² · s²)

let’s derive the function h(t):
  • in general, a distance is the product of velocity and time: s(t) = v·t (given that v is constant over time)
  • we know that’s not the case (v being constant), so we break it up into smaller parts: ds = v(t)·dt
  • this is to be integrated, ∫ ds = s(t) - s(0) = ∫ v(t) dt
  • at t = 0 let s(0) = 0 and v(0) = starting velocity (√(2·g·h[max]))
  • the velocity is changed by (positive or negative) acceleration: dv = a dt (a = const.)
  • integration yields: v(t) - v(0) = a·(t - t(0)) = a·t => v(t) = v(0) + a·t (a = –9.81 m/s²)
  • putting that into the above integral: s(t) = ∫ v(0) + a·t dt
  • reorganisation yields: s(t) = v(0) ∫ dt + a ∫ t dt
  • solving (and renaming) that yields: h(t) = v(0)·t - g/2 · t² (g = 9.81 m/s²)
  • thus we have derived the height equation for a full bounce

edit: when omitting item 3, the equation becomes somewhat more general: s(t) = s(0) + v(0)·t + (a/2)·t² (a and v(0) are positive if directed the same as s, which is usually upwards). here you can directly see the the equation for and upward-only and downward-only bounce as well as the derivations of distance: ds/dt = v, d²s/dt² = a

tip: in equations, always compare the units. if they don’t match up, the equation is wrong.

This post has been edited by Dormilich: 08 September 2013 - 03:36 AM

Was This Post Helpful? 0
  • +
  • -

#21 bboyzeez  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 143
  • Joined: 16-December 12

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 04:54 PM

ok thanks its going to take some time to understand what all that means that you wrote (i seriously didnt get to learn gsce physics yet alone anything higher so these symbols i will write and and see what each mean and then work it out and get back to you
Was This Post Helpful? 0
  • +
  • -

#22 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3572
  • View blog
  • Posts: 10,414
  • Joined: 08-June 10

Re: physics help needed , bouncing ball

Posted 07 September 2013 - 04:59 PM

View Postbboyzeez, on 08 September 2013 - 01:54 AM, said:

so these symbols i will write and and see what each mean and then work it out and get back to you

integral sign, essentially a summation over very very small intervals
d differential operator, essentially dx ≈ 0 ó a very very small interval
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2