Togglekey for player's friction.
by Shaan · in Technical Issues · 06/27/2005 (7:53 am) · 8 replies
Hi, I have added friction into my player to get him skid.
http://www.garagegames.com/mg/forums/result.thread.php?qt=20765
Now I need to bind this with a key to make it toggle.
After implementing the changes mentioned in above forum, I have tried this with no luck:
(in /client/scrips/default.bind.cs )
function toggleskid (%val)
{
if (%val)
$friction = 0.1;
else
$friction = 1.0;
}
moveMap.bind(keyboard, q, toggleskid);
I m new to torque, so if you guyz could help me. Thanx in advance.
http://www.garagegames.com/mg/forums/result.thread.php?qt=20765
Now I need to bind this with a key to make it toggle.
After implementing the changes mentioned in above forum, I have tried this with no luck:
(in /client/scrips/default.bind.cs )
function toggleskid (%val)
{
if (%val)
$friction = 0.1;
else
$friction = 1.0;
}
moveMap.bind(keyboard, q, toggleskid);
I m new to torque, so if you guyz could help me. Thanx in advance.
About the author
#2
06/28/2005 (7:14 am)
I tried that too, but no luck.
#3
Stick an echo statement in that function to make sure it is getting called. Beyond that you have to get the code working yourself.
06/28/2005 (7:23 am)
$friciton has to be bound somewhere. Setting it to a new value doesnt do anyhting... you want to change the friction value of hte players datablock. Stick an echo statement in that function to make sure it is getting called. Beyond that you have to get the code working yourself.
#4
I was wondering, by pressing a button, can i switch my player to another player who will have less friction to skid on the terrain and delete the first one.
Your help or suggestion will be highly appriciated. Thanx
06/30/2005 (3:14 am)
Hi, I have tried saveral stuff , still not working.I was wondering, by pressing a button, can i switch my player to another player who will have less friction to skid on the terrain and delete the first one.
Your help or suggestion will be highly appriciated. Thanx
#5
06/30/2005 (3:47 am)
That would be altering the firction feild of the datablock.
#6
is it true ? I don't think so. Bcoz, i have implemented different speed and other player related stuff which is modified by pressing a specific button while the game is running. Or may be the friction is related to physics engine, that is why we should nt change it.
guyz, i need your suggestions. plz
06/30/2005 (7:44 am)
I read somewhere, that we should not change the player's datablock while the game is running. is it true ? I don't think so. Bcoz, i have implemented different speed and other player related stuff which is modified by pressing a specific button while the game is running. Or may be the friction is related to physics engine, that is why we should nt change it.
guyz, i need your suggestions. plz
#7
06/30/2005 (8:10 am)
Change it... If it doesnt muck up then leave it. That is what I would do.
#8
06/30/2005 (8:33 am)
Chris, I did that, but it did nt work. I need to know, if it is possible to get this work. meanwhile i will continue trying my best.
Torque Owner Chris Labombard
Premium Preferred