<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=Hpl2%3ATutorials%3Ascript%3Aforce</id>
	<title>Hpl2:Tutorials:script:force - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=Hpl2%3ATutorials%3Ascript%3Aforce"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=Hpl2:Tutorials:script:force&amp;action=history"/>
	<updated>2026-05-14T03:01:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=Hpl2:Tutorials:script:force&amp;diff=860&amp;oldid=prev</id>
		<title>Maintenance script: Upload from wiki</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=Hpl2:Tutorials:script:force&amp;diff=860&amp;oldid=prev"/>
		<updated>2020-07-09T13:48:53Z</updated>

		<summary type="html">&lt;p&gt;Upload from wiki&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Force and impulses =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this tutorial I (xtron) will explain how to use Prop/Body force and impulses&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''How to get the coordinates:''' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create an item were the player/prop stands when it/he's geting pushed  then you press ctrl+d ( duplciate it ) and drag it to the place where&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
he's going to get pushed to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://imageshack.us/f/706/positiong.png/ imageshack.us/f/706/positiong.png/] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets say that blue dot is the player/prop and he's going to get pushed  to the chair that got the X position -3.5, you replace &amp;quot;float afX&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
with &amp;quot;-3.5f&amp;quot; and you're done.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And there you go, you just found out how to get the coordinates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== force/impulse: ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will use BodyForce for an example only, you can use PropForce exactly the same as BodyForce.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
AddBodyForce(string&amp;amp; asName, float afX, float afY, float afZ, string&amp;amp; asCoordSystem);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This function will push the player in a certain direction and by using the method I showed you, you will get the coordinates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will use the same coordinates shown on the picture.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://imageshack.us/f/706/positiong.png/ imageshack.us/f/706/positiong.png/] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets say the player stands on the blue dot and is geting to the chair. you will need to modify the function like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
AddBodyForce(&amp;quot;Player&amp;quot;, -3.5f, 0.0f, 0.0f, &amp;quot;world&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the player will now be pushed to the X coordinate -3.5. He will NOT move in the air unless you change the Y coordinate a bit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you move the chair upp a bit you will see that the Y coordinate will  change. When you're done you need to change the code again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Lets say you moved the chair so Y is 2.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
AddBodyForce(&amp;quot;Player&amp;quot;, -3.5f, 2.0f, 0.0f, &amp;quot;world&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now will the player fly abit aswell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''THIS CAN BE USED WITH''' &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
AddPropForce(string&amp;amp; asName, float afX, float afY, float afZ, string&amp;amp; asCoordSystem);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Aswell!''' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''READ!:''' IF YOU'RE GONNA USE AN IMPULSE I SUGGEST YOU USE HIGH NUMBERS LIKE &amp;quot;500.0f&amp;quot; OR &amp;quot;5000.0f&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''&amp;lt;u&amp;gt;Created by xtron&amp;lt;/u&amp;gt; ''&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
		
	</entry>
</feed>