Jump to content


Photo

3d Ball Physics Example


  • Please log in to reply
30 replies to this topic

#1 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 27 November 2008 - 03:48 PM

3D Ball Physics Example

Posted Image


Download ballz3d.gm6
  • 0

#2 Pie Person!

Pie Person!

    GM 6+ Lover

  • GMC Member
  • 1973 posts

Posted 27 November 2008 - 04:39 PM

This is great! Thank you :lol:.
  • 0

#3 ce gamer

ce gamer

    GMC Member

  • New Member
  • 134 posts

Posted 28 November 2008 - 03:04 PM

Nice example but after rolling around a little it gives an error:
ERROR in
action number 3
of Collision Event with object wall_block
for object ball:

Error in code at line 14:
ang_vel=nvel*tvel/n_length;
at position 30: Division by 0.
  • 0

#4 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 28 November 2008 - 03:35 PM

Fixed! Thanks! :lol:
  • 0

#5 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14395 posts
  • Version:GM:Studio

Posted 28 November 2008 - 06:50 PM

I guess my post did not stick...Weird


Can you explain how this is different that Quaternion (if it is) and how to set the rotation speed relative to the radius?

Edited by icuurd12b42, 28 November 2008 - 06:50 PM.

  • 0

#6 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 28 November 2008 - 06:58 PM

I don't know much about quaternions and the way I set the rotation speed is my own idea, and I don't set the rotation speed relative to the radius, because it's fixed here.
  • 0

#7 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14395 posts
  • Version:GM:Studio

Posted 28 November 2008 - 07:25 PM

I don't know much about quaternions and the way I set the rotation speed is my own idea, and I don't set the rotation speed relative to the radius, because it's fixed here.

I'm asking because this is much less code than what I have right now... I have balls of various radius though. So, if you know how to, it would be great.
  • 0

#8 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 28 November 2008 - 10:11 PM

Get a physics book because I don't remember exactly how to do it.. There will be something about moving in a circle, I think you can use that.
  • 0

#9 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4201 posts
  • Version:GM8.1

Posted 28 November 2008 - 11:12 PM

Well, I haven't really studied the course yet (and I'm so damned about it), but as far as I know, the rotation speed is indirectly relative to angular momentum, and that momentum, it is propotional to the ball's radius (and obviously its mass): solid ball 2/5*mr2; hollow ball 2/3*mr2. Besides, it's not a good idea to calculate speeds in simulating physics; it's all about forces and accelerations.

@them4n!ac:
Although I'd like to know how to simulate it accurately, this comes to show that you can get a very realistlic effect by just using some logic. This is for sure an useful example for many people. Good job. :lol:
  • 0

#10 goldsonic46

goldsonic46

    GMC Member

  • GMC Member
  • 581 posts

Posted 29 November 2008 - 10:37 PM

Is credit needed?
  • 0

#11 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 30 November 2008 - 06:53 PM

Tepi: thank you!
goldsonic46: of course! :)
  • 0

#12 infinitygames

infinitygames

    GMC Member

  • New Member
  • 254 posts

Posted 04 December 2008 - 10:22 PM

:P Physics? Were? this is just the D&D function to bounce of walls.... Althought the ball rotations its suitable :P
  • 0

#13 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4201 posts
  • Version:GM8.1

Posted 04 December 2008 - 11:00 PM

:P Physics? Were? this is just the D&D function to bounce of walls.... Althought the ball rotations its suitable :P

The ball doesn't rotate by itself...
  • 0

#14 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 05 December 2008 - 03:02 PM

there's the trick!
GM calculates the reflection vector with the bounce function and I use it!
  • 0

#15 AngelPL98

AngelPL98

    GMC Member

  • New Member
  • 43 posts

Posted 24 December 2008 - 12:04 PM

I will use it! I hope: You can create a 3d Online Ball Game!
  • 0

#16 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 24 December 2008 - 02:57 PM

If you want to use it with more balls, the drawing code must be changed.
  • 0

#17 infinitygames

infinitygames

    GMC Member

  • New Member
  • 254 posts

Posted 27 December 2008 - 03:21 PM

You would probably get a better and faster effect with GM newton...
  • 0

#18 Tepi

Tepi

    GMC Member

  • Global Moderators
  • 4201 posts
  • Version:GM8.1

Posted 27 December 2008 - 04:58 PM

You would probably get a better and faster effect with GM newton...

Yeah, and we'd probably get much better graphics with C++.

Now please let's not go to that.
  • 0

#19 Phantom107

Phantom107

    Engineer

  • GMC Member
  • 2600 posts
  • Version:GM:Studio

Posted 27 December 2008 - 05:34 PM

You would probably get a better and faster effect with GM newton...

Yeah, and we'd probably get much better graphics with C++.

Now please let's not go to that.

He's right though.

I've been using GMNewton a while back and now examples like these feel fake.
  • 0

#20 infinitygames

infinitygames

    GMC Member

  • New Member
  • 254 posts

Posted 04 January 2009 - 04:17 PM

You would probably get a better and faster effect with GM newton...

Yeah, and we'd probably get much better graphics with C++.

Now please let's not go to that.

He's right though.

I've been using GMNewton a while back and now examples like these feel fake.


He said it.... look into it! its realy good :3
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users