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

  • GMC Elder
  • 16028 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

  • GMC Elder
  • 16028 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
  • 4238 posts
  • Version:GM:Studio

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
  • 4238 posts
  • Version:GM:Studio

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
  • 4238 posts
  • Version:GM:Studio

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

    Graphics Enthusiast

  • GMC Member
  • 2665 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

#21 Red Fedora

Red Fedora

    GMC Member

  • New Member
  • 155 posts

Posted 04 January 2009 - 06:44 PM

Quite awesome. I'm using this for my upcoming Mini-game! Sadly however, when I make a moving block, it gets stuck, even with bounce.
  • 0

#22 them4n!ac

them4n!ac

    GMC Member

  • New Member
  • 1170 posts

Posted 06 January 2009 - 07:03 PM

You must move it out of the block yourself, then. Adding the velocity of the moving block to the ball's velocity should work fine.
  • 0

#23 Red Fedora

Red Fedora

    GMC Member

  • New Member
  • 155 posts

Posted 06 January 2009 - 09:06 PM

You must move it out of the block yourself, then. Adding the velocity of the moving block to the ball's velocity should work fine.


Oh, ok, I gotcha.
  • 0

#24 SparkzBolt

SparkzBolt

    Graphics....Zap

  • New Member
  • 416 posts

Posted 03 August 2009 - 08:12 PM

Im makeing a game with this,Ill give you proper credit,Its a maze game.
  • 0

#25 mrpickle:)

mrpickle:)

    RebelGamesCo.com-CEO

  • New Member
  • 205 posts

Posted 04 August 2009 - 04:33 AM

Im makeing a game with this,Ill give you proper credit,Its a maze game.

I'm with you.
I will give you a lot of credit for this!
  • 0

#26 Recreate

Recreate

    Furry

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

Posted 04 August 2009 - 04:47 AM

Im makeing a game with this,Ill give you proper credit,Its a maze game.

i hope you do a reasonable amount of work on it, Because it pretty much already is a maze XD
At least Change the projection code, So it does not look like you just ripped it off.
  • 0

#27 SparkzBolt

SparkzBolt

    Graphics....Zap

  • New Member
  • 416 posts

Posted 04 August 2009 - 11:47 PM

Its not just one maze,Its a whole sieries of areas and levals and custom balls.
I like the projection.....Its kinda perfect.
  • 0

#28 Lalo Landa

Lalo Landa

    GMC Member

  • New Member
  • 3 posts

Posted 11 June 2010 - 02:06 AM

it doesn't work well, one half of the ball is under the line of the floor!
  • 0

#29 Brawl

Brawl

    Magnitude Games

  • Local Moderators
  • 1285 posts
  • Version:GM:Studio

Posted 20 September 2010 - 10:26 PM

Great. Not to difficult to understand. Although I will need to look at it a bit longer to fully understand it. But this is really great. I have already started to alter it as a side project. Thought about a battle type game. Except with balls! Fun. :D I have to say that I am impressed quite a bit by this. Some stuff to be worked out. The jump. You can jump over and over and over. But that is a simple fix. I already got that down.

So yeah. 5/5 ::lmao::

EDIT: Found a glitch. When you hit a wall really really fast you shrink... How on earth could that happen?!

Edited by Brawlitall, 21 September 2010 - 02:20 AM.

  • 0

#30 PeJhes

PeJhes

    GMC Member

  • New Member
  • 23 posts

Posted 24 September 2010 - 10:47 PM

thanks for game... !!!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users