Dynamic and individualized gravity.
by Chris "Dark" Evans · in Torque Game Engine · 11/22/2001 (2:13 am) · 7 replies
I just wrote a small gravity mod. It lets you set the gravity of anything through script, items players whatever. You use %obj.setGravity(%val), and %obj.getGravity(). It automatically defaults at -20.
It's individual, so you could have one player that smashes into the ground, and one player that floats around like a baloon. It can be set at any time too.
Should I write a little tutorial on it? Would anyone else find this useful?
Dark
It's individual, so you could have one player that smashes into the ground, and one player that floats around like a baloon. It can be set at any time too.
Should I write a little tutorial on it? Would anyone else find this useful?
Dark
#2
11/22/2001 (5:25 am)
I think it would make a great tutorial or code snippit. It's different and there are ways that it could be used in a wide range of games.
#3
11/22/2001 (6:11 am)
Yes, I would like to see this, would solve some problems I have been thinking of making for myself :)
#4
If so, I would definately like you to make a tutorial on all your gravity changing code.
( hmmmm that didnt sound right...... meh its late and I've been coding all night.. need sleep *grin* )
11/22/2001 (2:24 pm)
Do you know how to make it so that each level has a different gravity value?If so, I would definately like you to make a tutorial on all your gravity changing code.
( hmmmm that didnt sound right...... meh its late and I've been coding all night.. need sleep *grin* )
#5
In the level you could set a variable $MissionGravity = -20; Then whenever a player or item spawns it would call %obj.setGravity($MissionGravity);.
I was thinking about making this for a spell/skill in our RPG, but it wasn't decided yet. Then a friend asked me to make it for him and I did.
I'll start on the tutorial now.
Dark
11/22/2001 (8:37 pm)
Ok, I'll do it.In the level you could set a variable $MissionGravity = -20; Then whenever a player or item spawns it would call %obj.setGravity($MissionGravity);.
I was thinking about making this for a spell/skill in our RPG, but it wasn't decided yet. Then a friend asked me to make it for him and I did.
I'll start on the tutorial now.
Dark
#6
When it's reviewed it should be titled Dynamic and Individualized Gravity.
Let me know of any problems.
Dark
11/22/2001 (10:27 pm)
Alright, it's finished.When it's reviewed it should be titled Dynamic and Individualized Gravity.
Let me know of any problems.
Dark
#7
Thank you.
:^}
11/23/2001 (4:59 am)
The other thing that doesn't necessarily get done around here often enough...Thank you.
:^}
Torque Owner Chris "Dark" Evans
It wasn't sending the new gravity to the client, and the client was using the default -20.
*Original:
After testing it some more I found a problem. It seems that the client and server aren't synching right.
Say I set the player's gravity to -10. He jumps twice as high according to the server, but the client side says he jumped with a -20 grav. The server realizes that the client is off, and it teleports it to where it should be.
I think it has something to do with the prediction code. I searched for -20 thinking it was hardcoded, but couldn't find it. I've found comments in the code saying that the game assumes a -20 gravity, I just don't know WHERE it assumes it. If someone can point me in the right direction I would appreciate it.
BTW, I also got it working with vehicle gravity. Projectile gravity looks like it uses a different system. It doesn't use the ShabeBase class either, so it would have to have it's own grav code written special for it.
Thanks for any replies,
Dark