Scripts / Ball Physics

Author
Message
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 25th Oct 2020 15:23
Is it possible to actually make a ball roll and not just glade?
I have played around wit the weight an physics with the soccer ball that is available in Mega Pact 3 and can get the ball to slide of from a
flat surface with a angle, but the ball do not actually roll.
How can i get the ball to roll.?
If i use a ball with a solid color then it looks like it is rolling but not really.


Would be awesome for anyone's help.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Oct 2020 16:36
Change the collisionmode in the fpe to be 2 for "sphere".
Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 25th Oct 2020 16:57 Edited at: 25th Oct 2020 17:20
Thanks AmenMoses, will try it

edit. : ok cool it works fine , ... just the ball takes for ever to stop rolling even with physics friction very high it takes along time to stop not like a normal ball.

I need to fiddle again and see if i can make it roll naturally.

Thanks Again AM
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Oct 2020 17:33 Edited at: 25th Oct 2020 17:39
Friction only works with terrain btw, and it's not very good.

If you want to tweak the physics attributes you need to use the physics lua commands.

SetObjectDamping( objectId, mv, rv )

That's the command you probably want to play around with.

Attach a script to the ball and in the _init function put:

SetObjectDamping( g_Entity[ e ].obj, 0.1, 0.1 )

Try it and see the effect.
Then tweak the values to suit, the values are 0 to 1, 1 means that the object will probably not move at all, 0 means free movement.
First value is is sort of like air friction, second is sort of like rolling resistance.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 25th Oct 2020 17:41
Btw, the file I attached is what I sent to Lee way back at the beginning of the year to add to global.lua, for some reason he never got around to adding it.
Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 25th Oct 2020 17:49
Thanks. AM, Your Programming talent is far above the value of money.
You have a good heart.
I will test it Asap
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 16GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 26th Oct 2020 23:49
It is a pity not to have these commands included in the global.lua file, this would allow us to be more productive and above all, it would help us to write more solid code, for our games.
I hope that when the development of GGMax is more advanced, Lee will have time to rethink it.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 27th Oct 2020 01:28
global.lua is just a way of documenting them, they exist anyhow and you can use them.
Been there, done that, got all the T-Shirts!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 27th Oct 2020 17:34
Quote: "for some reason he never got around to adding it."

Quote: " they exist anyhow and you can use them."

Oh, good to know.
Yes, documentation may be cool, there are a lot of commands I have not idea what they do.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-12-22 02:08:29
Your offset time is: 2024-12-22 02:08:29