Kiwi2703
Junior Member
Posts: 27
Threads: 5
Joined: Sep 2012
Reputation:
2
|
[SOLVED] AddBodyForce doesn't work
Hey
I have an area called ScriptArea_2. I want the player to be pushed forward (about 1 meter) and slighty upward (~0.2m) when he collides with the area.
The script looks like this:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_2", "theforce", true, 1);
}
void theforce(string &in asParent, string &in asChild, int alState)
{
AddBodyForce("Player", 0.0f, 500.0f, 5000.0f, "world");
}
I set the values so high only for experimental purposes. The problem is, when I walk into the area, absolutely nothing happens.
Any help? Thanks!
(This post was last modified: 09-07-2012, 10:50 AM by Kiwi2703.)
|
|
09-06-2012, 06:35 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
RE: AddBodyForce doesn't work
(09-06-2012, 06:35 PM)Kiwi2703 Wrote: Hey
I have an area called ScriptArea_2. I want the player to be pushed forward (about 1 meter) and slighty upward (~0.2m) when he collides with the area.
The script looks like this:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_2", "theforce", true, 1);
}
void theforce(string &in asParent, string &in asChild, int alState)
{
AddBodyForce("Player", 0.0f, 500.0f, 5000.0f, "world");
}
I set the values so high only for experimental purposes. The problem is, when I walk into the area, absolutely nothing happens.
Any help? Thanks! I don't see anything wrong with this. Have you created the script file while the map was open in Amnesia? If yes, close Amnesia, then start it again.
Also, are the names correct? Triple-check, to be sure.
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 09-06-2012, 06:43 PM by Robby.)
|
|
09-06-2012, 06:38 PM |
|
Kreekakon
Pick a god and pray!
Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation:
124
|
RE: AddBodyForce doesn't work
Try this command instead:
void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
|
|
09-06-2012, 06:44 PM |
|
EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: AddBodyForce doesn't work
AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
simply nuff said
|
|
09-06-2012, 06:44 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
RE: AddBodyForce doesn't work
Yeah, didn't think of ^. Try that instead.
LOL, 2 posts on the same time.
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
|
|
09-06-2012, 06:48 PM |
|
EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: AddBodyForce doesn't work
haha, this do happen us some times^^
simply nuff said
|
|
09-06-2012, 06:51 PM |
|
Kiwi2703
Junior Member
Posts: 27
Threads: 5
Joined: Sep 2012
Reputation:
2
|
RE: AddBodyForce doesn't work
(09-06-2012, 06:44 PM)Kreekakon Wrote: void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
It worked but I had to set the values to 10000.0f and higher... no idea why it wants so much power
Many thanks anyways!
|
|
09-06-2012, 06:52 PM |
|
EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: AddBodyForce doesn't work
about the callback:
Pushes the player into a certain direction. Note that you need values above ~2000 to see any effects.
simply nuff said
|
|
09-06-2012, 06:52 PM |
|
Robby
Posting Freak
Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation:
47
|
RE: AddBodyForce doesn't work
(09-06-2012, 06:52 PM)Kiwi2703 Wrote: (09-06-2012, 06:44 PM)Kreekakon Wrote: void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
It worked but I had to set the values to 10000.0f and higher... no idea why it wants so much power
Many thanks anyways!
Note that rather high values are needed when applying forces.
[align=start] As said on the script functions page located on the wiki. [/align]
Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
|
|
09-06-2012, 06:56 PM |
|
Kiwi2703
Junior Member
Posts: 27
Threads: 5
Joined: Sep 2012
Reputation:
2
|
RE: AddBodyForce doesn't work
(09-06-2012, 06:56 PM)Nemet Robert Wrote: (09-06-2012, 06:52 PM)Kiwi2703 Wrote: (09-06-2012, 06:44 PM)Kreekakon Wrote: void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
It worked but I had to set the values to 10000.0f and higher... no idea why it wants so much power
Many thanks anyways!
Note that rather high values are needed when applying forces.
[align=start]As said on the script functions page located on the wiki. [/align]
Actually, on the scripts page were some really low values.. like 3.5f and such
|
|
09-06-2012, 06:59 PM |
|
|